@@ -10,8 +10,68 @@ You can have an overview of our Spring Boot Server with the diagram below:
1010
1111![ spring-boot-jwt-authentication-spring-security-architecture] ( spring-boot-jwt-authentication-spring-security-architecture.png )
1212
13+ ## Dependency
14+ – If you want to use PostgreSQL:
15+ ``` xml
16+ <dependency >
17+ <groupId >org.postgresql</groupId >
18+ <artifactId >postgresql</artifactId >
19+ <scope >runtime</scope >
20+ </dependency >
21+ ```
22+ – or MySQL:
23+ ``` xml
24+ <dependency >
25+ <groupId >com.mysql</groupId >
26+ <artifactId >mysql-connector-j</artifactId >
27+ <scope >runtime</scope >
28+ </dependency >
29+ ```
30+ ## Configure Spring Datasource, JPA, App properties
31+ Open ` src/main/resources/application.properties `
32+ - For PostgreSQL:
33+ ```
34+ spring.datasource.url= jdbc:postgresql://localhost:5432/testdb
35+ spring.datasource.username= postgres
36+ spring.datasource.password= 123
37+
38+ spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation= true
39+ spring.jpa.properties.hibernate.dialect= org.hibernate.dialect.PostgreSQLDialect
40+
41+ # Hibernate ddl auto (create, create-drop, validate, update)
42+ spring.jpa.hibernate.ddl-auto= update
43+
44+ # App Properties
45+ bezkoder.app.jwtSecret= bezKoderSecretKey
46+ bezkoder.app.jwtExpirationMs= 86400000
47+ ```
48+ - For MySQL
49+ ```
50+ spring.datasource.url=jdbc:mysql://localhost:3306/testdb_spring?useSSL=false
51+ spring.datasource.username=root
52+ spring.datasource.password=123456
53+
54+ spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
55+ spring.jpa.hibernate.ddl-auto=update
56+
57+ # App Properties
58+ bezkoder.app.jwtSecret= ======================BezKoder=Spring===========================
59+ bezkoder.app.jwtExpirationMs=86400000
60+ ```
61+ ## Run Spring Boot application
62+ ```
63+ mvn spring-boot:run
64+ ```
65+
66+ ## Run following SQL insert statements
67+ ```
68+ INSERT INTO roles(name) VALUES('ROLE_USER');
69+ INSERT INTO roles(name) VALUES('ROLE_MODERATOR');
70+ INSERT INTO roles(name) VALUES('ROLE_ADMIN');
71+ ```
72+
1373For more detail, please visit:
14- > [ Secure Spring Boot App with Spring Security & JWT Authentication] ( https://bezkoder.com/spring-boot-jwt-authentication/ )
74+ > [ Secure Spring Boot with Spring Security & JWT Authentication] ( https://bezkoder.com/spring-boot-jwt-authentication/ )
1575
1676> [ For MongoDB] ( https://bezkoder.com/spring-boot-jwt-auth-mongodb/ )
1777
@@ -22,6 +82,8 @@ For more detail, please visit:
2282For instruction: [ Spring Boot Refresh Token with JWT example] ( https://bezkoder.com/spring-boot-refresh-token-jwt/ )
2383
2484## More Practice:
85+ > [ Spring Boot JWT Authentication example using HttpOnly Cookie] ( https://www.bezkoder.com/spring-boot-login-example-mysql/ )
86+
2587> [ Spring Boot File upload example with Multipart File] ( https://bezkoder.com/spring-boot-file-upload/ )
2688
2789> [ Exception handling: @RestControllerAdvice example in Spring Boot] ( https://bezkoder.com/spring-boot-restcontrolleradvice/ )
@@ -30,6 +92,12 @@ For instruction: [Spring Boot Refresh Token with JWT example](https://bezkoder.c
3092
3193> [ Spring Boot Pagination & Sorting example] ( https://www.bezkoder.com/spring-boot-pagination-sorting-example/ )
3294
95+ > Validation: [ Spring Boot Validate Request Body] ( https://www.bezkoder.com/spring-boot-validate-request-body/ )
96+
97+ > Documentation: [ Spring Boot and Swagger 3 example] ( https://www.bezkoder.com/spring-boot-swagger-3/ )
98+
99+ > Caching: [ Spring Boot Redis Cache example] ( https://www.bezkoder.com/spring-boot-redis-cache-example/ )
100+
33101Associations:
34102> [ Spring Boot One To Many example with Spring JPA, Hibernate] ( https://www.bezkoder.com/jpa-one-to-many/ )
35103
@@ -58,6 +126,10 @@ Deployment:
58126
59127> [ Spring Boot + Angular 14 JWT Authentication] ( https://www.bezkoder.com/angular-14-spring-boot-jwt-auth/ )
60128
129+ > [ Spring Boot + Angular 15 JWT Authentication] ( https://www.bezkoder.com/angular-15-spring-boot-jwt-auth/ )
130+
131+ > [ Spring Boot + Angular 16 JWT Authentication] ( https://www.bezkoder.com/angular-16-spring-boot-jwt-auth/ )
132+
61133> [ Spring Boot + React JWT Authentication] ( https://bezkoder.com/spring-boot-react-jwt-auth/ )
62134
63135## Fullstack CRUD App
@@ -100,6 +172,18 @@ Deployment:
100172
101173> [ Angular 14 + Spring Boot + PostgreSQL example] ( https://www.bezkoder.com/spring-boot-angular-14-postgresql/ )
102174
175+ > [ Angular 15 + Spring Boot + H2 Embedded Database example] ( https://www.bezkoder.com/spring-boot-angular-15-crud/ )
176+
177+ > [ Angular 15 + Spring Boot + MySQL example] ( https://www.bezkoder.com/spring-boot-angular-15-mysql/ )
178+
179+ > [ Angular 15 + Spring Boot + PostgreSQL example] ( https://www.bezkoder.com/spring-boot-angular-15-postgresql/ )
180+
181+ > [ Angular 16 + Spring Boot + H2 Embedded Database example] ( https://www.bezkoder.com/spring-boot-angular-16-crud/ )
182+
183+ > [ Angular 16 + Spring Boot + MySQL example] ( https://www.bezkoder.com/spring-boot-angular-16-mysql/ )
184+
185+ > [ Angular 16 + Spring Boot + PostgreSQL example] ( https://www.bezkoder.com/spring-boot-angular-16-postgresql/ )
186+
103187> [ React + Spring Boot + MySQL example] ( https://bezkoder.com/react-spring-boot-crud/ )
104188
105189> [ React + Spring Boot + PostgreSQL example] ( https://bezkoder.com/spring-boot-react-postgresql/ )
@@ -112,63 +196,3 @@ Run both Back-end & Front-end in one place:
112196> [ Integrate React.js with Spring Boot Rest API] ( https://bezkoder.com/integrate-reactjs-spring-boot/ )
113197
114198> [ Integrate Vue.js with Spring Boot Rest API] ( https://bezkoder.com/integrate-vue-spring-boot/ )
115-
116- ## Dependency
117- – If you want to use PostgreSQL:
118- ``` xml
119- <dependency >
120- <groupId >org.postgresql</groupId >
121- <artifactId >postgresql</artifactId >
122- <scope >runtime</scope >
123- </dependency >
124- ```
125- – or MySQL:
126- ``` xml
127- <dependency >
128- <groupId >mysql</groupId >
129- <artifactId >mysql-connector-java</artifactId >
130- <scope >runtime</scope >
131- </dependency >
132- ```
133- ## Configure Spring Datasource, JPA, App properties
134- Open ` src/main/resources/application.properties `
135- - For PostgreSQL:
136- ```
137- spring.datasource.url= jdbc:postgresql://localhost:5432/testdb
138- spring.datasource.username= postgres
139- spring.datasource.password= 123
140-
141- spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation= true
142- spring.jpa.properties.hibernate.dialect= org.hibernate.dialect.PostgreSQLDialect
143-
144- # Hibernate ddl auto (create, create-drop, validate, update)
145- spring.jpa.hibernate.ddl-auto= update
146-
147- # App Properties
148- bezkoder.app.jwtSecret= bezKoderSecretKey
149- bezkoder.app.jwtExpirationMs= 86400000
150- ```
151- - For MySQL
152- ```
153- spring.datasource.url= jdbc:mysql://localhost:3306/testdb?useSSL=false
154- spring.datasource.username= root
155- spring.datasource.password= 123456
156-
157- spring.jpa.properties.hibernate.dialect= org.hibernate.dialect.MySQL5InnoDBDialect
158- spring.jpa.hibernate.ddl-auto= update
159-
160- # App Properties
161- bezkoder.app.jwtSecret= bezKoderSecretKey
162- bezkoder.app.jwtExpirationMs= 86400000
163- ```
164- ## Run Spring Boot application
165- ```
166- mvn spring-boot:run
167- ```
168-
169- ## Run following SQL insert statements
170- ```
171- INSERT INTO roles(name) VALUES('ROLE_USER');
172- INSERT INTO roles(name) VALUES('ROLE_MODERATOR');
173- INSERT INTO roles(name) VALUES('ROLE_ADMIN');
174- ```
0 commit comments