File tree 7 files changed +61
-8
lines changed
java/com/springboot/blog/rest/api
7 files changed +61
-8
lines changed Original file line number Diff line number Diff line change 1
1
package com .springboot .blog .rest .api ;
2
2
3
+ import com .springboot .blog .rest .api .entity .Role ;
4
+ import com .springboot .blog .rest .api .repository .RoleRepository ;
3
5
import org .modelmapper .ModelMapper ;
6
+ import org .springframework .beans .factory .annotation .Autowired ;
7
+ import org .springframework .boot .CommandLineRunner ;
4
8
import org .springframework .boot .SpringApplication ;
5
9
import org .springframework .boot .autoconfigure .SpringBootApplication ;
6
10
import org .springframework .context .annotation .Bean ;
7
11
8
12
@ SpringBootApplication
9
- public class SpringbootBlogRestApiApplication {
13
+ public class SpringbootBlogRestApiApplication implements CommandLineRunner {
10
14
11
15
@ Bean
12
16
public ModelMapper modelMapper (){
@@ -17,4 +21,17 @@ public static void main(String[] args) {
17
21
SpringApplication .run (SpringbootBlogRestApiApplication .class , args );
18
22
}
19
23
24
+ @ Autowired
25
+ private RoleRepository roleRepository ;
26
+ @ Override
27
+ public void run (String ... args ) throws Exception {
28
+ //admin role
29
+ Role adminRole = new Role ();
30
+ adminRole .setName ("ROLE_ADMIN" );
31
+ roleRepository .save (adminRole );
32
+ //user role
33
+ Role userRole = new Role ();
34
+ userRole .setName ("ROLE_USER" );
35
+ roleRepository .save (userRole );
36
+ }
20
37
}
Original file line number Diff line number Diff line change
1
+
2
+ spring.jpa.database-platform =org.hibernate.dialect.MySQL5InnoDBDialect
3
+ spring.jpa.show-sql =true
4
+ spring.jpa.properties.hibernate.format_sql = true
5
+ # manirdev@235
6
+ spring.datasource.password =Password123#@!
7
+ spring.datasource.username =root
8
+ spring.datasource.url =jdbc:mysql://localhost:3306/devDB?serverTimezone=UTC
9
+ spring.jpa.hibernate.ddl-auto =update
Original file line number Diff line number Diff line change
1
+
2
+ spring.jpa.database-platform =org.hibernate.dialect.MySQL5InnoDBDialect
3
+ spring.jpa.show-sql =true
4
+ spring.jpa.properties.hibernate.format_sql = true
5
+ # manirdev@235
6
+ spring.datasource.password =root$123
7
+ spring.datasource.username =root
8
+ spring.datasource.url =jdbc:mysql://manirdev.cjvift6niayo.us-east-1.rds.amazonaws.com:3306/springbootBlogRestApi?serverTimezone=UTC
9
+ spring.jpa.hibernate.ddl-auto =update
10
+
11
+ # elastic build service port:
12
+ server.port =5000
13
+
Original file line number Diff line number Diff line change
1
+
2
+ spring.jpa.database-platform =org.hibernate.dialect.MySQL5InnoDBDialect
3
+ spring.jpa.show-sql =true
4
+ spring.jpa.properties.hibernate.format_sql = true
5
+ # manirdev@235
6
+ spring.datasource.password =Password123#@!
7
+ spring.datasource.username =root
8
+ spring.datasource.url =jdbc:mysql://localhost:3306/springbootBlogRestApi?serverTimezone=UTC
9
+ spring.jpa.hibernate.ddl-auto =update
10
+
Original file line number Diff line number Diff line change 1
1
2
- spring.jpa.database-platform =org.hibernate.dialect.MySQL5InnoDBDialect
3
- spring.jpa.show-sql =true
4
- spring.jpa.properties.hibernate.format_sql = true
5
- spring.datasource.password =manirdev@235
6
- spring.datasource.username =root
7
- spring.datasource.url =jdbc:mysql://localhost:3306/springbootBlogRestApi?serverTimezone=UTC
8
- spring.jpa.hibernate.ddl-auto =update
2
+ # spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
3
+ # spring.jpa.show-sql =true
4
+ # spring.jpa.properties.hibernate.format_sql= true
5
+ # spring.datasource.password=manirdev@235
6
+ # spring.datasource.username=root
7
+ # spring.datasource.url=jdbc:mysql://localhost:3306/springbootBlogRestApi?serverTimezone=UTC
8
+ # spring.jpa.hibernate.ddl-auto=update
9
9
10
10
logging.level.org.springframework.security =DEBUG
11
11
@@ -16,3 +16,7 @@ app.jwt-expiration-milliseconds = 604800000
16
16
# Swagger enabling
17
17
spring.mvc.pathmatch.matching-strategy = ANT_PATH_MATCHER
18
18
19
+ # Changing application properties to other deploy env
20
+ # this will activate prod,dev or qa properties file
21
+ spring.profiles.active =prod
22
+
You can’t perform that action at this time.
0 commit comments