File tree Expand file tree Collapse file tree 4 files changed +13
-13
lines changed
APIJSONBoot-MultiDataSource/src/main
APIJSONDemo-Druid/src/main/java/apijson/demo
APIJSONDemo-HikariCP/src/main/java/apijson/demo Expand file tree Collapse file tree 4 files changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -30,14 +30,14 @@ public class DemoDataSourceConfig {
3030
3131 @ Bean
3232 @ ConfigurationProperties (prefix = "spring.datasource.hikari" )
33- public HikariDataSource hikaricpDataSource (){
33+ public HikariDataSource hikaricpDataSource () {
3434 return new HikariDataSource ();
3535 }
3636
3737
3838 @ Bean
3939 @ ConfigurationProperties (prefix = "spring.datasource.druid" )
40- public DruidDataSource druidDataSource (){
40+ public DruidDataSource druidDataSource () {
4141 return new DruidDataSource ();
4242 }
4343
Original file line number Diff line number Diff line change @@ -7,10 +7,10 @@ spring:
77# password: apijson
88 hikari :
99 type : com.zaxxer.hikari.HikariDataSource
10- driver-class-name : com.mysql.cj.jdbc .Driver
11- jdbc-url : jdbc:mysql ://localhost:3306?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8
12- username : root
13- password : apijson
10+ driver-class-name : org.postgresql .Driver
11+ jdbc-url : jdbc:postgresql ://localhost:5432/postgres
12+ username : postgres
13+ password :
1414 minimum-idle : 5
1515 idle-timeout : 600000
1616 maximum-pool-size : 10
Original file line number Diff line number Diff line change 2121import com .alibaba .druid .pool .DruidDataSource ;
2222
2323
24- /**Druid 连接池配置 ,对应 application.yml 的 datasource 配置
24+ /**数据源配置 ,对应 application.yml 的数据库连接池 datasource 配置
2525 * @author Lemon
2626 */
2727@ Configuration
28- public class DemoDruidConfig {
29-
28+ public class DemoDataSourceConfig {
29+
3030 @ Bean
3131 @ ConfigurationProperties (prefix = "spring.datasource.druid" )
32- public DruidDataSource dataSource () {
32+ public DruidDataSource druidDataSource () {
3333 return new DruidDataSource ();
3434 }
35-
35+
3636}
Original file line number Diff line number Diff line change 2222import javax .sql .DataSource ;
2323
2424
25- /**HikariCP 连接池配置 ,对应 application.yml 的 datasource 配置
25+ /**数据源配置 ,对应 application.yml 的数据库连接池 datasource 配置
2626 * @author Lemon
2727 */
2828@ Configuration
2929public class DemoDataSourceConfig {
3030
3131 @ Bean
3232 @ ConfigurationProperties (prefix = "spring.datasource.hikari" )
33- public DataSource dataSource (){
33+ public DataSource dataSource () {
3434 return new HikariDataSource ();
3535 }
3636
You can’t perform that action at this time.
0 commit comments