简单接入mybatisplus动态数据源

96
mymx2
2019-09-06 11:24 字数 1788 阅读 50评论 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


Blade
登录 后发表评论
0条评论
还没有人评论过~