1、dynamic-datasource基础文档说明
https://gitcode.net/mirrors/baomidou/dynamic-datasource-spring-boot-starter?utm_source=csdn_github_accelerator
2、dynamic-datasource在配置多数据源时支持在使用时加载,这样只要其他数据源能连接,某一数据源不能连接时,就可以不影响项目启动和其他数据源的使用了。
spring:
datasource:
dynamic:
primary: master_zxhj #设置默认的数据源或者数据源组,默认值即为master
strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源.
datasource:
master_zxhj:
driver-class-name: com.mysql.cj.jdbc.Driver
url:xxx
username: xxx
password: xxx
nextcloud_zxhj:
url: xxx
username:
password: xxx
lazy: true //l懒加载属性,需要的时候再创建连接