Commit 19d1ce57 authored by 赵啸非's avatar 赵啸非

修改线程初始化数量

parent 1a57d5ae
...@@ -4,11 +4,11 @@ import com.alibaba.druid.pool.DruidDataSource; ...@@ -4,11 +4,11 @@ import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
import javax.sql.DataSource; import javax.sql.DataSource;
import java.sql.SQLException; import java.sql.SQLException;
@Component //@Component
@ConfigurationProperties(prefix = "spring.datasource") @ConfigurationProperties(prefix = "spring.datasource")
public class DruidSource { public class DruidSource {
......
...@@ -64,18 +64,36 @@ spring: ...@@ -64,18 +64,36 @@ spring:
exceptiontranslation: exceptiontranslation:
enabled: false enabled: false
datasource: datasource:
type: com.alibaba.druid.pool.DruidDataSource #type: com.alibaba.druid.pool.DruidDataSource
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: @profiles.datasource.uri@ url: @profiles.datasource.uri@
username: @profiles.datasource.username@ username: @profiles.datasource.username@
password: @profiles.datasource.password@ password: @profiles.datasource.password@
initial-size: 10 # initial-size: 10
min-idle: 10 # min-idle: 10
max-active: 20 # max-active: 20
# 配置获取连接等待超时的时间 # # 配置获取连接等待超时的时间
max-wait: 60000 # max-wait: 60000
test-on-borrow: true # test-on-borrow: true
test-while-idle: true # test-while-idle: true
# 连接池
hikari:
#连接池名
pool-name: DateHikariCP
#最小空闲连接数
minimum-idle: 5
# 空闲连接存活最大时间,默认600000(10分钟)
idle-timeout: 180000
# 连接池最大连接数,默认是10
maximum-pool-size: 15
# 此属性控制从池返回的连接的默认自动提交行为,默认值:true
auto-commit: true
# 此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认1800000即30分钟
max-lifetime: 1800000
# 数据库连接超时时间,默认30秒,即30000
connection-timeout: 30000
connection-test-query: SELECT 1
mybatis: mybatis:
root-path: com.mortals root-path: com.mortals
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment