|
26 | 26 | import org.mybatis.spring.SqlSessionTemplate;
|
27 | 27 | import org.springframework.aop.scope.ScopedProxyFactoryBean;
|
28 | 28 | import org.springframework.aop.scope.ScopedProxyUtils;
|
| 29 | +import org.springframework.beans.factory.FactoryBean; |
29 | 30 | import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition;
|
30 | 31 | import org.springframework.beans.factory.config.BeanDefinition;
|
31 | 32 | import org.springframework.beans.factory.config.BeanDefinitionHolder;
|
@@ -57,6 +58,9 @@ public class ClassPathMapperScanner extends ClassPathBeanDefinitionScanner {
|
57 | 58 |
|
58 | 59 | private static final Logger LOGGER = LoggerFactory.getLogger(ClassPathMapperScanner.class);
|
59 | 60 |
|
| 61 | + // Copy of FactoryBean#OBJECT_TYPE_ATTRIBUTE which was added in Spring 5.2 |
| 62 | + static final String FACTORY_BEAN_OBJECT_TYPE = "factoryBeanObjectType"; |
| 63 | + |
60 | 64 | private boolean addToConfig = true;
|
61 | 65 |
|
62 | 66 | private boolean lazyInitialization;
|
@@ -234,6 +238,10 @@ private void processBeanDefinitions(Set<BeanDefinitionHolder> beanDefinitions) {
|
234 | 238 |
|
235 | 239 | definition.getPropertyValues().add("addToConfig", this.addToConfig);
|
236 | 240 |
|
| 241 | + // Attribute for MockitoPostProcessor |
| 242 | + // https://github.com/mybatis/spring-boot-starter/issues/475 |
| 243 | + definition.setAttribute(FactoryBean.OBJECT_TYPE_ATTRIBUTE, beanClassName); |
| 244 | + |
237 | 245 | boolean explicitFactoryUsed = false;
|
238 | 246 | if (StringUtils.hasText(this.sqlSessionFactoryBeanName)) {
|
239 | 247 | definition.getPropertyValues().add("sqlSessionFactory",
|
|
0 commit comments