|
1 | 1 | /**
|
2 |
| - * Copyright 2010-2017 the original author or authors. |
| 2 | + * Copyright 2010-2019 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -69,7 +69,7 @@ public class ClassPathMapperScanner extends ClassPathBeanDefinitionScanner {
|
69 | 69 |
|
70 | 70 | private Class<?> markerInterface;
|
71 | 71 |
|
72 |
| - private MapperFactoryBean<?> mapperFactoryBean = new MapperFactoryBean<>(); |
| 72 | + private Class<? extends MapperFactoryBean> mapperFactoryBeanClass = MapperFactoryBean.class; |
73 | 73 |
|
74 | 74 | public ClassPathMapperScanner(BeanDefinitionRegistry registry) {
|
75 | 75 | super(registry, false);
|
@@ -103,10 +103,23 @@ public void setSqlSessionFactoryBeanName(String sqlSessionFactoryBeanName) {
|
103 | 103 | this.sqlSessionFactoryBeanName = sqlSessionFactoryBeanName;
|
104 | 104 | }
|
105 | 105 |
|
| 106 | + /** |
| 107 | + * @deprecated Since 2.0.1, Please use the {@link #setMapperFactoryBeanClass(Class)}. |
| 108 | + */ |
| 109 | + @Deprecated |
106 | 110 | public void setMapperFactoryBean(MapperFactoryBean<?> mapperFactoryBean) {
|
107 |
| - this.mapperFactoryBean = mapperFactoryBean != null ? mapperFactoryBean : new MapperFactoryBean<>(); |
| 111 | + this.mapperFactoryBeanClass = mapperFactoryBean == null ? MapperFactoryBean.class : mapperFactoryBean.getClass(); |
108 | 112 | }
|
109 | 113 |
|
| 114 | + /** |
| 115 | + * Set the {@code MapperFactoryBean} class. |
| 116 | + * |
| 117 | + * @param mapperFactoryBeanClass the {@code MapperFactoryBean} class |
| 118 | + * @since 2.0.1 |
| 119 | + */ |
| 120 | + public void setMapperFactoryBeanClass(Class<? extends MapperFactoryBean> mapperFactoryBeanClass) { |
| 121 | + this.mapperFactoryBeanClass = mapperFactoryBeanClass == null ? MapperFactoryBean.class : mapperFactoryBeanClass; |
| 122 | + } |
110 | 123 |
|
111 | 124 | /**
|
112 | 125 | * Configures parent scanner to search for the right interfaces. It can search
|
@@ -174,7 +187,7 @@ private void processBeanDefinitions(Set<BeanDefinitionHolder> beanDefinitions) {
|
174 | 187 | // the mapper interface is the original class of the bean
|
175 | 188 | // but, the actual class of the bean is MapperFactoryBean
|
176 | 189 | definition.getConstructorArgumentValues().addGenericArgumentValue(beanClassName); // issue #59
|
177 |
| - definition.setBeanClass(this.mapperFactoryBean.getClass()); |
| 190 | + definition.setBeanClass(this.mapperFactoryBeanClass); |
178 | 191 |
|
179 | 192 | definition.getPropertyValues().add("addToConfig", this.addToConfig);
|
180 | 193 |
|
|
0 commit comments