修改配置
This commit is contained in:
parent
dbfb51ce71
commit
5b806edae0
|
|
@ -3,6 +3,7 @@ package com.chinaweal.youfool.prj.config;
|
||||||
import com.baomidou.mybatisplus.core.config.GlobalConfig;
|
import com.baomidou.mybatisplus.core.config.GlobalConfig;
|
||||||
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
||||||
import com.chinaweal.youfool.framework.springboot.mybatis.plus.CommonMetaObjectHandler;
|
import com.chinaweal.youfool.framework.springboot.mybatis.plus.CommonMetaObjectHandler;
|
||||||
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
@ -24,7 +25,7 @@ public class PrjDataSource {
|
||||||
@Resource
|
@Resource
|
||||||
private CommonMetaObjectHandler commonMetaObjectHandler;
|
private CommonMetaObjectHandler commonMetaObjectHandler;
|
||||||
|
|
||||||
@Bean(name = "sqlSessionFactory")
|
@Bean
|
||||||
@Primary
|
@Primary
|
||||||
public MybatisSqlSessionFactoryBean sqlSessionFactory(DataSource dataSource) throws Exception {
|
public MybatisSqlSessionFactoryBean sqlSessionFactory(DataSource dataSource) throws Exception {
|
||||||
MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();
|
MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();
|
||||||
|
|
@ -33,7 +34,10 @@ public class PrjDataSource {
|
||||||
globalConfig.setMetaObjectHandler(commonMetaObjectHandler);
|
globalConfig.setMetaObjectHandler(commonMetaObjectHandler);
|
||||||
bean.setGlobalConfig(globalConfig);
|
bean.setGlobalConfig(globalConfig);
|
||||||
bean.setConfigLocation(new ClassPathResource("mybatis/mybatis-config.xml"));
|
bean.setConfigLocation(new ClassPathResource("mybatis/mybatis-config.xml"));
|
||||||
bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:mybatis/mapper/**/*.xml"));
|
org.springframework.core.io.Resource[] prjResources = new PathMatchingResourcePatternResolver().getResources("classpath*:mybatis/mapper/**/*.xml");
|
||||||
|
org.springframework.core.io.Resource[] cmsResources = new PathMatchingResourcePatternResolver().getResources("classpath*:cms/mybatis/mapper/**/*.xml");
|
||||||
|
org.springframework.core.io.Resource[] resources = ArrayUtils.addAll(prjResources, cmsResources);
|
||||||
|
bean.setMapperLocations(resources);
|
||||||
return bean;
|
return bean;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ logging:
|
||||||
root: info
|
root: info
|
||||||
spring:
|
spring:
|
||||||
profiles:
|
profiles:
|
||||||
active: @profiles.active@
|
active: dev
|
||||||
application:
|
application:
|
||||||
name: youfool-prj-springboot-template
|
name: youfool-prj-springboot-template
|
||||||
datasource:
|
datasource:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue