修改配置
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.extension.spring.MybatisSqlSessionFactoryBean;
|
||||
import com.chinaweal.youfool.framework.springboot.mybatis.plus.CommonMetaObjectHandler;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
|
@ -24,7 +25,7 @@ public class PrjDataSource {
|
|||
@Resource
|
||||
private CommonMetaObjectHandler commonMetaObjectHandler;
|
||||
|
||||
@Bean(name = "sqlSessionFactory")
|
||||
@Bean
|
||||
@Primary
|
||||
public MybatisSqlSessionFactoryBean sqlSessionFactory(DataSource dataSource) throws Exception {
|
||||
MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();
|
||||
|
|
@ -33,7 +34,10 @@ public class PrjDataSource {
|
|||
globalConfig.setMetaObjectHandler(commonMetaObjectHandler);
|
||||
bean.setGlobalConfig(globalConfig);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ logging:
|
|||
root: info
|
||||
spring:
|
||||
profiles:
|
||||
active: @profiles.active@
|
||||
active: dev
|
||||
application:
|
||||
name: youfool-prj-springboot-template
|
||||
datasource:
|
||||
|
|
|
|||
Loading…
Reference in New Issue