Skip to content

Commit 636311e

Browse files
committed
Better Spring Pattern
1 parent 9315210 commit 636311e

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/test/java/issues/gh324/spring/TestConfiguration.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@
1515
*/
1616
package issues.gh324.spring;
1717

18-
import issues.gh324.NameTableMapper;
1918
import org.apache.ibatis.session.SqlSessionFactory;
2019
import org.mybatis.spring.SqlSessionFactoryBean;
21-
import org.mybatis.spring.mapper.MapperFactoryBean;
20+
import org.mybatis.spring.annotation.MapperScan;
2221
import org.springframework.context.annotation.Bean;
2322
import org.springframework.context.annotation.Configuration;
2423
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
@@ -29,6 +28,7 @@
2928
import javax.sql.DataSource;
3029

3130
@Configuration
31+
@MapperScan("issues.gh324")
3232
public class TestConfiguration {
3333
@Bean
3434
public DataSource dataSource() {
@@ -46,14 +46,6 @@ public SqlSessionFactory sqlSessionFactory() throws Exception {
4646
return factoryBean.getObject();
4747
}
4848

49-
@Bean
50-
public MapperFactoryBean<NameTableMapper> nameTableMapper() throws Exception {
51-
MapperFactoryBean<NameTableMapper> factory = new MapperFactoryBean<>();
52-
factory.setMapperInterface(NameTableMapper.class);
53-
factory.setSqlSessionFactory(sqlSessionFactory());
54-
return factory;
55-
}
56-
5749
@Bean
5850
public PlatformTransactionManager platformTransactionManager() {
5951
return new DataSourceTransactionManager(dataSource());

0 commit comments

Comments
 (0)