The diagram shows flow of how we implement User Registration, User Login and Authorization process.
You can have an overview of our Spring Boot Server with the diagram below:
– If you want to use PostgreSQL:
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
– or MySQL:
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
Open src/main/resources/application.properties
- For PostgreSQL:
spring.datasource.url= jdbc:postgresql://host.docker.internal:5432/testdb
spring.datasource.username= postgres
spring.datasource.password= 123
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation= true
spring.jpa.properties.hibernate.dialect= org.hibernate.dialect.PostgreSQLDialect
# Hibernate ddl auto (create, create-drop, validate, update)
spring.jpa.hibernate.ddl-auto= update
# App Properties
nrapendra.app.jwtSecret=580b4613e846959bc75076eea4fdcda2f83b4fe89265d04ae78c86fdf48bc1c6
nrapendra.app.jwtExpirationMs= 86400000
- For MySQL
spring.datasource.url=jdbc:mysql://host.docker.internal:3306/testdb_spring?useSSL=false
spring.datasource.username=root
spring.datasource.password=123456
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
spring.jpa.hibernate.ddl-auto=update
# App Properties
nrapendra.app.jwtSecret=580b4613e846959bc75076eea4fdcda2f83b4fe89265d04ae78c86fdf48bc1c6
nrapendra.app.jwtExpirationMs=86400000
mvn spring-boot:run
INSERT INTO roles(id,name) VALUES(1,'ROLE_USER');
INSERT INTO roles(id,name) VALUES(2,'ROLE_MODERATOR');
INSERT INTO roles(id,name) VALUES(3,'ROLE_ADMIN');
For more detail, please visit: