-
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.
- Loading branch information
1 parent
4323b43
commit 01833f7
Showing
13 changed files
with
171 additions
and
67 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
26 changes: 26 additions & 0 deletions
26
src/main/java/bankingapi/util/config/DatasourceConfiguration.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,26 @@ | ||
package bankingapi.util.config; | ||
|
||
import com.zaxxer.hikari.HikariDataSource; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.boot.jdbc.DataSourceBuilder; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Primary; | ||
|
||
import javax.sql.DataSource; | ||
|
||
@Configuration | ||
public class DatasourceConfiguration { | ||
@Primary | ||
@Bean | ||
@ConfigurationProperties("spring.datasource.hikari") | ||
public DataSource dataSource() { | ||
return DataSourceBuilder.create().type(HikariDataSource.class).build(); | ||
} | ||
|
||
@Bean | ||
@ConfigurationProperties("userlock.datasource.hikari") | ||
public DataSource userLockDataSource() { | ||
return DataSourceBuilder.create().type(HikariDataSource.class).build(); | ||
} | ||
} |
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,12 +0,0 @@ | ||
spring: | ||
datasource: | ||
url: ${SPRING_DATASOURCE_URL:jdbc:mysql://localhost:3306/money_transfer_service?characterEncoding=UTF-8&serverTimezone=Asia/Seoul} | ||
driver-class-name: com.mysql.cj.jdbc.Driver | ||
username: ${SPRING_DATASOURCE_USERNAME:root} | ||
password: ${SPRING_DATASOURCE_PASSWORD:password!} | ||
jpa: | ||
database: mysql | ||
database-platform: org.hibernate.dialect.MySQLDialect | ||
show-sql: true | ||
hibernate: | ||
ddl-auto: create | ||
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,43 @@ | ||
spring: | ||
datasource: | ||
hikari: | ||
maximum-pool-size: 20 | ||
max-lifetime: 60000 | ||
driver-class-name: org.testcontainers.jdbc.ContainerDatabaseDriver | ||
jdbc-url: jdbc:tc:mysql:8.0.24://localhost:3306/test | ||
connection-timeout: 5000 | ||
pool-name: Spring-HikariPool | ||
dbcp2: | ||
driver-class-name: com.mysql.cj.jdbc.Driver | ||
test-on-borrow: true | ||
validation-query: SELECT 1 | ||
jpa: | ||
show-sql: true | ||
hibernate: | ||
ddl-auto: create | ||
generate-ddl: true | ||
jdbc: | ||
template: | ||
query-timeout: 2 | ||
|
||
userlock: | ||
datasource: | ||
hikari: | ||
maximum-pool-size: 20 | ||
max-lifetime: 60000 | ||
driver-class-name: org.testcontainers.jdbc.ContainerDatabaseDriver | ||
jdbc-url: jdbc:tc:mysql:8.0.24://localhost:3306/test | ||
connection-timeout: 5000 | ||
pool-name: UserLock-HikariPool | ||
|
||
logging: | ||
level: | ||
org.hibernate: | ||
SQL: debug | ||
tool.hbm2ddl: debug | ||
type: trace | ||
stat: debug | ||
type.BasicTypeRegistry: warn | ||
org.springframework.jdbc: debug | ||
org.springframework.transaction: debug | ||
bankingapi.concurrency: debug |
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,3 +1,30 @@ | ||
spring: | ||
profiles: | ||
active: local | ||
datasource: | ||
hikari: | ||
maximum-pool-size: 20 | ||
max-lifetime: 60000 | ||
driver-class-name: com.mysql.cj.jdbc.Driver | ||
jdbc-url: ${SPRING_DATASOURCE_URL:jdbc:mysql://localhost:3306/money_transfer_service?characterEncoding=UTF-8&serverTimezone=Asia/Seoul} | ||
username: ${SPRING_DATASOURCE_USERNAME:root} | ||
password: ${SPRING_DATASOURCE_PASSWORD:password!} | ||
connection-timeout: 5000 | ||
pool-name: Spring-HikariPool | ||
|
||
jpa: | ||
database: mysql | ||
database-platform: org.hibernate.dialect.MySQLDialect | ||
show-sql: true | ||
hibernate: | ||
ddl-auto: create | ||
|
||
userlock: | ||
datasource: | ||
hikari: | ||
maximum-pool-size: 20 | ||
max-lifetime: 60000 | ||
jdbc-url: ${SPRING_DATASOURCE_URL:jdbc:mysql://localhost:3306/money_transfer_service?characterEncoding=UTF-8&serverTimezone=Asia/Seoul} | ||
username: ${SPRING_DATASOURCE_USERNAME:root} | ||
password: ${SPRING_DATASOURCE_PASSWORD:password!} | ||
driver-class-name: com.mysql.cj.jdbc.Driver | ||
connection-timeout: 5000 | ||
pool-name: UserLock-HikariPool |
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
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
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
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 was deleted.
Oops, something went wrong.