From 137275a8cdb7029cea95dc47b4bcc533a4ae2261 Mon Sep 17 00:00:00 2001 From: wangbing Date: Wed, 18 Dec 2019 16:51:19 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E7=BB=A7=E6=89=BF=E5=A4=9A=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: 8a0b347c120ab04c46207489dd6fbea675703c74 --- .../modules/SpringBoot/java/config/MapperMainConfig.java | 6 +++--- .../modules/SpringBoot/java/config/MapperTwoConfig.java | 6 +++--- src/main/resources/modules/SpringBoot/pom.ftl | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/resources/modules/SpringBoot/java/config/MapperMainConfig.java b/src/main/resources/modules/SpringBoot/java/config/MapperMainConfig.java index 06f2e68d..44a785fc 100644 --- a/src/main/resources/modules/SpringBoot/java/config/MapperMainConfig.java +++ b/src/main/resources/modules/SpringBoot/java/config/MapperMainConfig.java @@ -1,4 +1,4 @@ -package com.example.config; +package ${basePackage}.config; import org.apache.ibatis.session.SqlSessionFactory; import org.mybatis.spring.SqlSessionFactoryBean; @@ -15,7 +15,7 @@ import org.springframework.jdbc.datasource.DataSourceTransactionManager; import javax.sql.DataSource; @Configuration -@MapperScan(basePackages = {"com.example.*.mainMpr"}, sqlSessionFactoryRef = "mainSqlSessionFactory") +@MapperScan(basePackages = {"${basePackage}.*.mainMpr"}, sqlSessionFactoryRef = "mainSqlSessionFactory") public class MapperMainConfig { @Bean(name = "mainDataSource") @Primary @@ -35,7 +35,7 @@ public class MapperMainConfig { public SqlSessionFactory basicSqlSessionFactory(@Qualifier("mainDataSource") DataSource basicDataSource) throws Exception { SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean(); factoryBean.setDataSource(basicDataSource); - factoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:com/example/**/mainMpr/*.xml")); + factoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:**/mainMpr/*.xml")); return factoryBean.getObject(); } } \ No newline at end of file diff --git a/src/main/resources/modules/SpringBoot/java/config/MapperTwoConfig.java b/src/main/resources/modules/SpringBoot/java/config/MapperTwoConfig.java index 70ac16ac..36eddaaf 100644 --- a/src/main/resources/modules/SpringBoot/java/config/MapperTwoConfig.java +++ b/src/main/resources/modules/SpringBoot/java/config/MapperTwoConfig.java @@ -1,4 +1,4 @@ -package com.example.config; +package ${basePackage}.config; import org.apache.ibatis.session.SqlSessionFactory; import org.mybatis.spring.SqlSessionFactoryBean; @@ -14,7 +14,7 @@ import org.springframework.jdbc.datasource.DataSourceTransactionManager; import javax.sql.DataSource; @Configuration -@MapperScan(basePackages = {"com.example.*.twoMpr"}, sqlSessionFactoryRef = "twoSqlSessionFactory") +@MapperScan(basePackages = {"${basePackage}.*.twoMpr"}, sqlSessionFactoryRef = "twoSqlSessionFactory") public class MapperTwoConfig { @Bean(name = "TwoDataSource") @ConfigurationProperties(prefix = "spring.datasource.two") @@ -31,7 +31,7 @@ public class MapperTwoConfig { public SqlSessionFactory basicSqlSessionFactory(@Qualifier("twoDataSource") DataSource basicDataSource) throws Exception { SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean(); factoryBean.setDataSource(basicDataSource); - factoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:com/example/**/twoMpr/*.xml")); + factoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:**/twoMpr/*.xml")); return factoryBean.getObject(); } } \ No newline at end of file diff --git a/src/main/resources/modules/SpringBoot/pom.ftl b/src/main/resources/modules/SpringBoot/pom.ftl index 91484a52..278bb87f 100644 --- a/src/main/resources/modules/SpringBoot/pom.ftl +++ b/src/main/resources/modules/SpringBoot/pom.ftl @@ -186,7 +186,7 @@ src/main/java - **/mpr/*.xml + **/*Mapper.xml