Spring Boot MyBatis配置多种数据库

mybatis-config.xml是支持配置多种数据库的,本文将介绍在Spring Boot中使用配置类来配置。

1. 配置application.yml

# mybatis配置
mybatis:
  check-config-location: false
  type-aliases-package: ${base.package}.model
  configuration:
    map-underscore-to-camel-case: true
    # 二级缓存的总开关
    cache-enabled: false
  mapper-locations: classpath:mapping/*.xml

2. 新增数据源配置类

原文地址:https://www.cnblogs.com/jpfss/p/11242716.html