update Readme
Show how to configure source code to work with MySQL or PostgreSQL
This commit is contained in:
parent
b95d4719ea
commit
67a1e5fa1d
49
README.md
49
README.md
|
@ -1,4 +1,4 @@
|
||||||
# Spring Boot JWT Authentication example with Spring Security & PostgreSQL
|
# Spring Boot JWT Authentication example with Spring Security & Spring Data JPA
|
||||||
|
|
||||||
For more detail, please visit:
|
For more detail, please visit:
|
||||||
> [Secure Spring Boot App with Spring Security & JWT Authentication](https://bezkoder.com/spring-boot-jwt-authentication/)
|
> [Secure Spring Boot App with Spring Security & JWT Authentication](https://bezkoder.com/spring-boot-jwt-authentication/)
|
||||||
|
@ -9,7 +9,54 @@ For more detail, please visit:
|
||||||
|
|
||||||
> [Spring Boot + Angular 8 JWT Authentication](https://bezkoder.com/angular-spring-boot-jwt-auth/)
|
> [Spring Boot + Angular 8 JWT Authentication](https://bezkoder.com/angular-spring-boot-jwt-auth/)
|
||||||
|
|
||||||
|
## Dependency
|
||||||
|
– If you want to use PostgreSQL:
|
||||||
|
```xml
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.postgresql</groupId>
|
||||||
|
<artifactId>postgresql</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
```
|
||||||
|
– or MySQL:
|
||||||
|
```xml
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
```
|
||||||
|
## Configure Spring Datasource, JPA, App properties
|
||||||
|
Open `src/main/resources/application.properties`
|
||||||
|
- For PostgreSQL:
|
||||||
|
```
|
||||||
|
spring.datasource.url= jdbc:postgresql://localhost: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
|
||||||
|
bezkoder.app.jwtSecret= bezKoderSecretKey
|
||||||
|
bezkoder.app.jwtExpirationMs= 86400000
|
||||||
|
```
|
||||||
|
- For MySQL
|
||||||
|
```
|
||||||
|
spring.datasource.url= jdbc:mysql://localhost:3306/testdb?useSSL=false
|
||||||
|
spring.datasource.username= root
|
||||||
|
spring.datasource.password= 123456
|
||||||
|
|
||||||
|
spring.jpa.properties.hibernate.dialect= org.hibernate.dialect.MySQL5InnoDBDialect
|
||||||
|
spring.jpa.hibernate.ddl-auto= update
|
||||||
|
|
||||||
|
# App Properties
|
||||||
|
bezkoder.app.jwtSecret= bezKoderSecretKey
|
||||||
|
bezkoder.app.jwtExpirationMs= 86400000
|
||||||
|
```
|
||||||
## Run Spring Boot application
|
## Run Spring Boot application
|
||||||
```
|
```
|
||||||
mvn spring-boot:run
|
mvn spring-boot:run
|
||||||
|
|
Loading…
Reference in New Issue