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 {
30
30
31
31
@ Bean
32
32
@ ConfigurationProperties (prefix = "spring.datasource.hikari" )
33
- public HikariDataSource hikaricpDataSource (){
33
+ public HikariDataSource hikaricpDataSource () {
34
34
return new HikariDataSource ();
35
35
}
36
36
37
37
38
38
@ Bean
39
39
@ ConfigurationProperties (prefix = "spring.datasource.druid" )
40
- public DruidDataSource druidDataSource (){
40
+ public DruidDataSource druidDataSource () {
41
41
return new DruidDataSource ();
42
42
}
43
43
Original file line number Diff line number Diff line change @@ -7,10 +7,10 @@ spring:
7
7
# password: apijson
8
8
hikari :
9
9
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 :
14
14
minimum-idle : 5
15
15
idle-timeout : 600000
16
16
maximum-pool-size : 10
Original file line number Diff line number Diff line change 21
21
import com .alibaba .druid .pool .DruidDataSource ;
22
22
23
23
24
- /**Druid 连接池配置 ,对应 application.yml 的 datasource 配置
24
+ /**数据源配置 ,对应 application.yml 的数据库连接池 datasource 配置
25
25
* @author Lemon
26
26
*/
27
27
@ Configuration
28
- public class DemoDruidConfig {
29
-
28
+ public class DemoDataSourceConfig {
29
+
30
30
@ Bean
31
31
@ ConfigurationProperties (prefix = "spring.datasource.druid" )
32
- public DruidDataSource dataSource () {
32
+ public DruidDataSource druidDataSource () {
33
33
return new DruidDataSource ();
34
34
}
35
-
35
+
36
36
}
Original file line number Diff line number Diff line change 22
22
import javax .sql .DataSource ;
23
23
24
24
25
- /**HikariCP 连接池配置 ,对应 application.yml 的 datasource 配置
25
+ /**数据源配置 ,对应 application.yml 的数据库连接池 datasource 配置
26
26
* @author Lemon
27
27
*/
28
28
@ Configuration
29
29
public class DemoDataSourceConfig {
30
30
31
31
@ Bean
32
32
@ ConfigurationProperties (prefix = "spring.datasource.hikari" )
33
- public DataSource dataSource (){
33
+ public DataSource dataSource () {
34
34
return new HikariDataSource ();
35
35
}
36
36
You can’t perform that action at this time.
0 commit comments