Skip to content

Commit b4a6caf

Browse files
author
ramazansakin
committed
initialize Roles not to get "Role not found errors"
1 parent 3740c4a commit b4a6caf

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/main/resources/application.properties

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
server.port=8080
22
spring.application.name=spring-boot-jwt-auth
33

4-
spring.datasource.url=jdbc:mysql://localhost:3306/testdb?useSSL=false
4+
spring.datasource.url=jdbc:mysql://localhost:3306/testdb
55
spring.datasource.username=root
66
spring.datasource.password=123456
77

88
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
99
spring.jpa.hibernate.ddl-auto=update
10+
spring.sql.init.mode=always
11+
spring.sql.init.schema-locations=classpath:init_roles.sql
1012

1113
# JWT Properties
1214
bezkoder.app.jwtSecret=bezKoderSecretKey

src/main/resources/init_roles.sql

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
INSERT INTO roles (name)
2+
VALUES ('ROLE_USER'),
3+
('ROLE_MODERATOR'),
4+
('ROLE_ADMIN') ON DUPLICATE KEY
5+
UPDATE name = name;

0 commit comments

Comments
 (0)