Skip to content

Commit 63a42ae

Browse files
committed
Merge pull request #59 from dguggi/master
#58 added possibility to apply mapperInterface to MapperFactoryBean via ...
2 parents 3b05b57 + 4d37501 commit 63a42ae

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44
/.project
55
*.epoch
66
*.log
7+
*.iml
8+
/.idea

src/main/java/org/mybatis/spring/mapper/ClassPathMapperScanner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ private void processBeanDefinitions(Set<BeanDefinitionHolder> beanDefinitions) {
177177

178178
// the mapper interface is the original class of the bean
179179
// but, the actual class of the bean is MapperFactoryBean
180-
definition.getPropertyValues().add("mapperInterface", definition.getBeanClassName());
180+
definition.getConstructorArgumentValues().addGenericArgumentValue(definition.getBeanClassName());
181181
definition.setBeanClass(MapperFactoryBean.class);
182182

183183
definition.getPropertyValues().add("addToConfig", this.addToConfig);

src/main/java/org/mybatis/spring/mapper/MapperFactoryBean.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,15 @@ public class MapperFactoryBean<T> extends SqlSessionDaoSupport implements Factor
5858

5959
private boolean addToConfig = true;
6060

61-
/**
61+
62+
public MapperFactoryBean(Class<T> mapperInterface) {
63+
this.mapperInterface = mapperInterface;
64+
}
65+
66+
public MapperFactoryBean() {
67+
}
68+
69+
/**
6270
* Sets the mapper interface of the MyBatis mapper
6371
*
6472
* @param mapperInterface class of the interface

0 commit comments

Comments
 (0)