springboot(application)多数据源配置

nacos 多数据源配置,注意对齐(级别之间的关系 特别是dynamic primary datasource)
一开始我将dynamic 跟 primary 放在同一节别。就错了。启动不了,找不到默认数据源。

security:
  oauth2:
    client:
      client-id: ENC(YCqgZwfB95z4dseDQgwU+w==)
      client-secret: ENC(YCqgZwfB95z4dseDQgwU+w==)
      scope: server
      ignore-urls:
      - /druid/**
allow-multiple-login: true
login-error: true
login-error-num: 5
spring:
  datasource:
    dynamic:  #设置默认的数据源或者数据源组合
    # 设置默认的数据源或者数据源组,默认值即为master
      primary: mysql
      # 严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源
      strict: false
      type: com.alibaba.druid.pool.DruidDataSource
      datasource:
        mysql:
          driver-class-name: com.mysql.cj.jdbc.Driver
          username: xxx
          password: xxx
          url: jdbc:mysql:xxx
        oracle:
          driver-class-name: oracle.jdbc.driver.OracleDriver
          username: xxx
          password: xxx
          url: jdbc:oracle:thin:@xxx
      stat-view-servlet:
        enabled: true
        url-pattern: /druid/*
      filter:
        stat:
          enabled: true
          log-slow-sql: true
          slow-sql-millis: 10000
          merge-sql: false
        wall:
          config:
            multi-statement-allow: true
config:
  upload:
    file-path: /data/sbs-platform-dev,D:xx
    file-temp-path: /data/sbs-platform-dev

jwt:
  expiration: 10
client:
  root_address: http://localhost:8080
email:
  mailSmtpUsername: xxxxxxxxx
  mailSmtpHost: xxx
  mailSmtpPassword: xxxxxxxxxxx
  siteName: xxx
elastic:
  url: xxxx
  username: elastic
  password: elastic
management:
  health:
    elasticsearch:
      enabled: false

eam:
  url: http:xxxx

你可能感兴趣的:(spring,boot,后端,java)