Skip to content

Commit 1d8c8cc

Browse files
committed
update to Spring Boot 3
1 parent edaf308 commit 1d8c8cc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+876
-109
lines changed

Diff for: README.md

+85-61
Original file line numberDiff line numberDiff line change
@@ -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+
1373
For 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:
2282
For 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+
33101
Associations:
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-
```

Diff for: bin/.gitignore

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
HELP.md
2+
target/
3+
!.mvn/wrapper/maven-wrapper.jar
4+
!**/src/main/**
5+
!**/src/test/**
6+
7+
### STS ###
8+
.apt_generated
9+
.classpath
10+
.factorypath
11+
.project
12+
.settings
13+
.springBeans
14+
.sts4-cache
15+
16+
### IntelliJ IDEA ###
17+
.idea
18+
*.iws
19+
*.iml
20+
*.ipr
21+
22+
### NetBeans ###
23+
/nbproject/private/
24+
/nbbuild/
25+
/dist/
26+
/nbdist/
27+
/.nb-gradle/
28+
build/
29+
30+
### VS Code ###
31+
.vscode/

Diff for: bin/.mvn/wrapper/MavenWrapperDownloader.class

4.78 KB
Binary file not shown.

Diff for: bin/.mvn/wrapper/maven-wrapper.jar

47.2 KB
Binary file not shown.

Diff for: bin/.mvn/wrapper/maven-wrapper.properties

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip

Diff for: bin/README.md

+155
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
# Spring Boot JWT Authentication example with Spring Security & Spring Data JPA
2+
3+
## User Registration, User Login and Authorization process.
4+
The diagram shows flow of how we implement User Registration, User Login and Authorization process.
5+
6+
![spring-boot-jwt-authentication-spring-security-flow](spring-boot-jwt-authentication-spring-security-flow.png)
7+
8+
## Spring Boot Server Architecture with Spring Security
9+
You can have an overview of our Spring Boot Server with the diagram below:
10+
11+
![spring-boot-jwt-authentication-spring-security-architecture](spring-boot-jwt-authentication-spring-security-architecture.png)
12+
13+
For more detail, please visit:
14+
> [Secure Spring Boot App with Spring Security & JWT Authentication](https://bezkoder.com/spring-boot-jwt-authentication/)
15+
16+
> [For MongoDB](https://bezkoder.com/spring-boot-jwt-auth-mongodb/)
17+
18+
## Refresh Token
19+
20+
![spring-boot-refresh-token-jwt-example-flow](spring-boot-refresh-token-jwt-example-flow.png)
21+
22+
For instruction: [Spring Boot Refresh Token with JWT example](https://bezkoder.com/spring-boot-refresh-token-jwt/)
23+
24+
## Fullstack Authentication
25+
26+
> [Spring Boot + Vue.js JWT Authentication](https://bezkoder.com/spring-boot-vue-js-authentication-jwt-spring-security/)
27+
28+
> [Spring Boot + Angular 8 JWT Authentication](https://bezkoder.com/angular-spring-boot-jwt-auth/)
29+
30+
> [Spring Boot + Angular 10 JWT Authentication](https://bezkoder.com/angular-10-spring-boot-jwt-auth/)
31+
32+
> [Spring Boot + Angular 11 JWT Authentication](https://bezkoder.com/angular-11-spring-boot-jwt-auth/)
33+
34+
> [Spring Boot + Angular 12 JWT Authentication](https://www.bezkoder.com/angular-12-spring-boot-jwt-auth/)
35+
36+
> [Spring Boot + React JWT Authentication](https://bezkoder.com/spring-boot-react-jwt-auth/)
37+
38+
## Fullstack CRUD App
39+
40+
> [Vue.js + Spring Boot + H2 Embedded database example](https://www.bezkoder.com/spring-boot-vue-js-crud-example/)
41+
42+
> [Vue.js + Spring Boot + MySQL example](https://www.bezkoder.com/spring-boot-vue-js-mysql/)
43+
44+
> [Vue.js + Spring Boot + PostgreSQL example](https://www.bezkoder.com/spring-boot-vue-js-postgresql/)
45+
46+
> [Angular 8 + Spring Boot + Embedded database example](https://www.bezkoder.com/angular-spring-boot-crud/)
47+
48+
> [Angular 8 + Spring Boot + MySQL example](https://bezkoder.com/angular-spring-boot-crud/)
49+
50+
> [Angular 8 + Spring Boot + PostgreSQL example](https://bezkoder.com/angular-spring-boot-postgresql/)
51+
52+
> [Angular 10 + Spring Boot + MySQL example](https://bezkoder.com/angular-10-spring-boot-crud/)
53+
54+
> [Angular 10 + Spring Boot + PostgreSQL example](https://bezkoder.com/angular-10-spring-boot-postgresql/)
55+
56+
> [Angular 11 + Spring Boot + MySQL example](https://bezkoder.com/angular-11-spring-boot-crud/)
57+
58+
> [Angular 11 + Spring Boot + PostgreSQL example](https://bezkoder.com/angular-11-spring-boot-postgresql/)
59+
60+
> [Angular 12 + Spring Boot + Embedded database example](https://www.bezkoder.com/angular-12-spring-boot-crud/)
61+
62+
> [Angular 12 + Spring Boot + MySQL example](https://www.bezkoder.com/angular-12-spring-boot-mysql/)
63+
64+
> [Angular 12 + Spring Boot + PostgreSQL example](https://www.bezkoder.com/angular-12-spring-boot-postgresql/)
65+
66+
> [Angular 13 + Spring Boot + H2 Embedded Database example](https://www.bezkoder.com/spring-boot-angular-13-crud/)
67+
68+
> [Angular 13 + Spring Boot + MySQL example](https://www.bezkoder.com/spring-boot-angular-13-mysql/)
69+
70+
> [Angular 13 + Spring Boot + PostgreSQL example](https://www.bezkoder.com/spring-boot-angular-13-postgresql/)
71+
72+
> [React + Spring Boot + MySQL example](https://bezkoder.com/react-spring-boot-crud/)
73+
74+
> [React + Spring Boot + PostgreSQL example](https://bezkoder.com/spring-boot-react-postgresql/)
75+
76+
> [React + Spring Boot + MongoDB example](https://bezkoder.com/react-spring-boot-mongodb/)
77+
78+
Run both Back-end & Front-end in one place:
79+
> [Integrate Angular with Spring Boot Rest API](https://bezkoder.com/integrate-angular-spring-boot/)
80+
81+
> [Integrate React.js with Spring Boot Rest API](https://bezkoder.com/integrate-reactjs-spring-boot/)
82+
83+
> [Integrate Vue.js with Spring Boot Rest API](https://bezkoder.com/integrate-vue-spring-boot/)
84+
85+
More Practice:
86+
> [Spring Boot File upload example with Multipart File](https://bezkoder.com/spring-boot-file-upload/)
87+
88+
> [Exception handling: @RestControllerAdvice example in Spring Boot](https://bezkoder.com/spring-boot-restcontrolleradvice/)
89+
90+
> [Spring Boot Repository Unit Test with @DataJpaTest](https://bezkoder.com/spring-boot-unit-test-jpa-repo-datajpatest/)
91+
92+
Deployment:
93+
> [Deploy Spring Boot App on AWS – Elastic Beanstalk](https://www.bezkoder.com/deploy-spring-boot-aws-eb/)
94+
95+
> [Docker Compose Spring Boot and MySQL example](https://www.bezkoder.com/docker-compose-spring-boot-mysql/)
96+
97+
## Dependency
98+
– If you want to use PostgreSQL:
99+
```xml
100+
<dependency>
101+
<groupId>org.postgresql</groupId>
102+
<artifactId>postgresql</artifactId>
103+
<scope>runtime</scope>
104+
</dependency>
105+
```
106+
– or MySQL:
107+
```xml
108+
<dependency>
109+
<groupId>mysql</groupId>
110+
<artifactId>mysql-connector-java</artifactId>
111+
<scope>runtime</scope>
112+
</dependency>
113+
```
114+
## Configure Spring Datasource, JPA, App properties
115+
Open `src/main/resources/application.properties`
116+
- For PostgreSQL:
117+
```
118+
spring.datasource.url= jdbc:postgresql://localhost:5432/testdb
119+
spring.datasource.username= postgres
120+
spring.datasource.password= 123
121+
122+
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation= true
123+
spring.jpa.properties.hibernate.dialect= org.hibernate.dialect.PostgreSQLDialect
124+
125+
# Hibernate ddl auto (create, create-drop, validate, update)
126+
spring.jpa.hibernate.ddl-auto= update
127+
128+
# App Properties
129+
bezkoder.app.jwtSecret= bezKoderSecretKey
130+
bezkoder.app.jwtExpirationMs= 86400000
131+
```
132+
- For MySQL
133+
```
134+
spring.datasource.url= jdbc:mysql://localhost:3306/testdb?useSSL=false
135+
spring.datasource.username= root
136+
spring.datasource.password= 123456
137+
138+
spring.jpa.properties.hibernate.dialect= org.hibernate.dialect.MySQL5InnoDBDialect
139+
spring.jpa.hibernate.ddl-auto= update
140+
141+
# App Properties
142+
bezkoder.app.jwtSecret= bezKoderSecretKey
143+
bezkoder.app.jwtExpirationMs= 86400000
144+
```
145+
## Run Spring Boot application
146+
```
147+
mvn spring-boot:run
148+
```
149+
150+
## Run following SQL insert statements
151+
```
152+
INSERT INTO roles(name) VALUES('ROLE_USER');
153+
INSERT INTO roles(name) VALUES('ROLE_MODERATOR');
154+
INSERT INTO roles(name) VALUES('ROLE_ADMIN');
155+
```

0 commit comments

Comments
 (0)