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. 新增数据源配置类 /** * 数据源配置 * @author simon * @date 2019-02-18 */ @Configuration public class DataSourceConfig { @Value("${mybatis.mapper-locations}") private String mapperLocations; @Primary @Bean @Configur...
