-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…t-mysql-connect Feature/#21 spring boot mysql connect
- Loading branch information
Showing
5 changed files
with
70 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
/Server/.gradle/ | ||
/Server/.idea/ | ||
/Server/build/ | ||
/Server/src/main/resources/application.properties | ||
/.idea/ | ||
/Server/out/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
Server/src/main/java/JGS/CasperEvent/global/config/AppConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package JGS.CasperEvent.global.config; | ||
|
||
import org.apache.commons.dbcp2.BasicDataSource; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import javax.sql.DataSource; | ||
|
||
@Configuration | ||
public class AppConfig { | ||
|
||
@Value("${SPRING_DATASOURCE_URL}") | ||
private String datasourceUrl; | ||
|
||
@Value("${SPRING_DATASOURCE_USERNAME}") | ||
private String datasourceUsername; | ||
|
||
@Value("${SPRING_DATASOURCE_PASSWORD}") | ||
private String datasourcePassword; | ||
|
||
@Value("${SPRING_JPA_HIBERNATE_DDL_AUTO}") | ||
private String hibernateDdlAuto; | ||
|
||
@Value("${SPRING_REDIS_HOST}") | ||
private String redisHost; | ||
|
||
@Value("${SPRING_REDIS_PORT}") | ||
private String redisPort; | ||
|
||
@Bean | ||
public DataSource dataSource() { | ||
BasicDataSource dataSource = new BasicDataSource(); | ||
dataSource.setUrl(datasourceUrl); | ||
dataSource.setUsername(datasourceUsername); | ||
dataSource.setPassword(datasourcePassword); | ||
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); | ||
return dataSource; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
spring: | ||
jpa: | ||
hibernate: | ||
ddl-auto: update | ||
show-sql: true | ||
properties: | ||
hibernate: | ||
dialect: org.hibernate.dialect.MySQL5Dialect | ||
|
||
aws: | ||
region: ap-northeast-2 | ||
|
||
spring.config.import: aws-parameterstore:/spring-app/ |