简单接入mybatisplus动态数据源

mymx2
mymx2 2019-09-06 11:24
阅读需:0


yaml配置:

spring:
  autoconfigure:
    exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
  datasource:
    dynamic:
      primary: mysql #设置默认的数据源或者数据源组,默认值即为master
      strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源.
      datasource:
        mysql:
          driver-class-name: com.mysql.cj.jdbc.Driver
          url: jdbc:mysql://xxx:3306/bladex?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
          username: root
          password: xxx
        kong_postgresql:
          # PostgreSQL
          driver-class-name: org.postgresql.Driver
          url: jdbc:postgresql://xxx:5432/kong
          username: kong
          password: kong


评论
  • 魔羯座8838
    2021-02-24 08:17
    从2.5.6,升级到下一个版本就报错了,请问有人遇到这个问题吗
    6 回复