Springboot 文件形式配置Druid

Springboot2.0之後,只有Druid1.1.10以上的版本才能支持:

pom.xml

<dependency>
   <groupId>com.alibaba</groupId>
   <artifactId>druid-spring-boot-starter</artifactId>
   <version>1.1.21</version>
</dependency>

application.properities

###########數據庫配置##########
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
##開發用
spring.datasource.url=jdbc:mysql://1.1.1.1:3306/baoyandao?characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
##部署用
#spring.datasource.url=jdbc:mysql://1.1.1.1:3306/baoyandao?characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
spring.datasource.username=111
spring.datasource.password=111

#druid
spring.datasource.druid.initial-size=10
spring.datasource.druid.min-idle=10
spring.datasource.druid.maxActive=20
s
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章