需求:A库同步B库数据信息
需求分析:当前系统需要整合多数据,读取数据需要去切换数据源。
系统内容:配置文件管理中心:nacos
整合多数据源过程:
1、nacos中添加多数据源配置信息:
spring:
autoconfigure:
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
datasource:
type: com.alibaba.druid.pool.DruidDataSource
dynamic:
primary: master #设置默认的数据源或者数据源组,默认值即为master
strict: false
datasource:
master:
url: jdbc:mysql://localhost:3306/bpm_test?useUnicode=true&serverTimezone=UTC&characterEncoding=UTF-8&useSSL=false&rewriteBatchedStatements=true
username: root
password: root
salve:
username: root
password: root
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/ehr_test?useUnicod