Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5f0e0bd

Browse files
Merge pull request #6 from adiletkdev/develop
App Properties
2 parents ff5d2bf + 54667c2 commit 5f0e0bd

File tree

5 files changed

+60
-12
lines changed

5 files changed

+60
-12
lines changed

‎src/main/java/com/springboot/blog/SpringbootBlogRestApiApplication.java‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
package com.springboot.blog;
22

3+
import com.springboot.blog.entity.Role;
4+
import com.springboot.blog.repository.RoleRepository;
35
import io.swagger.v3.oas.annotations.ExternalDocumentation;
46
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
57
import io.swagger.v3.oas.annotations.info.Contact;
68
import io.swagger.v3.oas.annotations.info.Info;
79
import io.swagger.v3.oas.annotations.info.License;
810
import org.modelmapper.ModelMapper;
11+
import org.springframework.beans.factory.annotation.Autowired;
12+
import org.springframework.boot.CommandLineRunner;
913
import org.springframework.boot.SpringApplication;
1014
import org.springframework.boot.autoconfigure.SpringBootApplication;
1115
import org.springframework.context.annotation.Bean;
@@ -31,7 +35,7 @@
3135
url = "https://github.com/adiletkdev/springboot-blog-rest-api"
3236
)
3337
)
34-
public class SpringbootBlogRestApiApplication {
38+
public class SpringbootBlogRestApiApplication implementsCommandLineRunner{
3539

3640
@Bean
3741
public ModelMapper modelMapper() {
@@ -42,4 +46,17 @@ public static void main(String[] args) {
4246
SpringApplication.run(SpringbootBlogRestApiApplication.class, args);
4347
}
4448

49+
@Autowired
50+
private RoleRepository roleRepository;
51+
52+
@Override
53+
public void run(String... args) throws Exception {
54+
Role adminRole = new Role();
55+
adminRole.setName("ROLE_ADMIN");
56+
roleRepository.save(adminRole);
57+
58+
Role userRole = new Role();
59+
userRole.setName("ROLE_USER");
60+
roleRepository.save(userRole);
61+
}
4562
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
spring.datasource.url=jdbc:mysql://localhost:3306/myblog
2+
spring.datasource.username=bestuser
3+
spring.datasource.password=bestuser
4+
5+
# hibernate properties
6+
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
7+
8+
# hibernate ddl auto (create, create-drop, validate, update)
9+
spring.jpa.hibernate.ddl-auto=update
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
spring.datasource.url=jdbc:mysql://javajdk.cwhtfxb3sdkv.eu-north-1.rds.amazonaws.com:3306/myblog
2+
spring.datasource.username=root
3+
spring.datasource.password=javajdk123
4+
5+
# hibernate properties
6+
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
7+
8+
# hibernate ddl auto (create, create-drop, validate, update)
9+
spring.jpa.hibernate.ddl-auto=update
10+
11+
server.port=5000
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
spring.datasource.url=jdbc:mysql://localhost:3306/myblog
2+
spring.datasource.username=bestuser
3+
spring.datasource.password=bestuser
4+
5+
# hibernate properties
6+
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
7+
8+
# hibernate ddl auto (create, create-drop, validate, update)
9+
spring.jpa.hibernate.ddl-auto=update
Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
spring.datasource.url=jdbc:mysql://localhost:3306/myblog
2-
spring.datasource.username=bestuser
3-
spring.datasource.password=bestuser
4-
# hibernate properties
5-
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
6-
# hibernate ddl auto (create, create-drop, validate, update)
7-
spring.jpa.hibernate.ddl-auto=update
8-
#spring.security.user.name=user
9-
#spring.security.user.password=user
10-
#spring.security.user.roles=ADMIN
1+
#spring.datasource.url=jdbc:mysql://localhost:3306/myblog
2+
#spring.datasource.username=bestuser
3+
#spring.datasource.password=bestuser
4+
## hibernate properties
5+
#spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
6+
## hibernate ddl auto (create, create-drop, validate, update)
7+
#spring.jpa.hibernate.ddl-auto=update
8+
##spring.security.user.name=user
9+
##spring.security.user.password=user
10+
##spring.security.user.roles=ADMIN
1111

1212
#secret javaproject
1313
app.jwt-secret=ce02356f9917223373f26bb97ef5c3e4fafef9cde898bf9cf960e7d08e74ffef
14-
app-jwt-expiration-milliseconds=604800000
14+
app-jwt-expiration-milliseconds=604800000
15+
16+
spring.profiles.active=prod

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /