springboot版本:2.1.1.RELEASE
啓動日誌:
運行日誌:
附上配置信息
server.port=8001
server.servlet.context-path=/dev
#數據源配置(默認)
#useSSL=false MySQL在高版本需要指明是否進行SSL連接(不加第一次連接數據庫會有警告信息)
spring.datasource.driver=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://192.168.0.123:3306/test001?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false
spring.datasource.username=root
spring.datasource.password=root
#ds1,ds2 其他兩個數據源
slave.datasource.names=ds1,ds2
#ds1
slave.datasource.ds1.driver=com.mysql.cj.jdbc.Driver
slave.datasource.ds1.url=jdbc:mysql://192.168.0.123:3306/slave1?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false
slave.datasource.ds1.username=root
slave.datasource.ds1.password=root
#ds2
slave.datasource.ds2.driver=com.mysql.cj.jdbc.Driver
slave.datasource.ds2.url=jdbc:mysql://192.168.0.123:3306/slave2?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false
slave.datasource.ds2.username=root
slave.datasource.ds2.password=root
# 下面爲連接池的補充設置,應用到上面所有數據源中
spring.datasource.maximum-pool-size=100
spring.datasource.max-idle=10
spring.datasource.max-wait=10000
spring.datasource.min-idle=5
spring.datasource.initial-size=5
spring.datasource.validation-query=SELECT 1
spring.datasource.test-on-borrow=false
spring.datasource.test-while-idle=true
spring.datasource.time-between-eviction-runs-millis=18800
#mapper.xml文件
mybatis.mapper-locations=classpath:mapper/*.xml