SpringBoot使用Druid配置多数据源的配置文件application.properties

#第一个数据源
spring.datasource.druid.one.url=jdbc:mysql://localhost:3306/masterDB?characterEncoding=utf8&useSSL=true
spring.datasource.druid.one.username=root
spring.datasource.druid.one.password=root
spring.datasource.druid.one.driver-class-name=com.mysql.jdbc.Driver

#第二个数据源
spring.datasource.druid.two.url=jdbc:mysql://localhost:3306/secondDB?characterEncoding=utf8&useSSL=true
spring.datasource.druid.two.username=root
spring.datasource.druid.two.password=root
spring.datasource.druid.two.driver-class-name=com.mysql.jdbc.Driver

# 连接池配置,下面配置说明请参考Druid Github Wiki,配置_DruidDataSource参考配置

# 初始化大小,最小,最大
spring.datasource.druid.initialSize=5
spring.datasource.druid.minIdle=5
spring.datasource.druid.maxActive=30


######Druid监控配置######
#下面配置说明请参考Druid Github Wiki,配置_配置WebStatFilter
spring.datasource.druid.WebStatFilter.exclusions=*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*

#下面配置说明请参考Druid Github Wiki,配置_StatViewServlet配置
spring.datasource.druid.StatViewServlet.loginUsername=druid
spring.datasource.druid.StatViewServlet.loginPassword=druid


# 配置StatFilter  **打印慢sql** 大于200毫秒的标记为慢sql
spring.datasource.druid.filter.stat.db-type=mysql
spring.datasource.druid.filter.stat.log-slow-sql=true
spring.datasource.druid.filter.stat.slow-sql-millis=200

你可能感兴趣的:(SpringBoot)