|
21 | 21 |
|
22 | 22 | import org.apache.ibatis.session.SqlSessionFactory;
|
23 | 23 | import org.mybatis.spring.SqlSessionTemplate;
|
| 24 | +import org.springframework.beans.BeansException; |
24 | 25 | import org.springframework.beans.factory.InitializingBean;
|
25 | 26 | import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition;
|
26 | 27 | import org.springframework.beans.factory.config.BeanDefinition;
|
27 | 28 | import org.springframework.beans.factory.config.BeanDefinitionHolder;
|
28 |
| -import org.springframework.beans.factory.config.BeanFactoryPostProcessor; |
29 | 29 | import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
30 | 30 | import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
| 31 | +import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor; |
31 | 32 | import org.springframework.beans.factory.support.GenericBeanDefinition;
|
32 | 33 | import org.springframework.context.ApplicationContext;
|
33 | 34 | import org.springframework.context.ApplicationContextAware;
|
|
43 | 44 | import org.springframework.util.StringUtils;
|
44 | 45 |
|
45 | 46 | /**
|
46 |
| - * BeanFactoryPostProcessor that searches recursively starting from a base package for interfaces |
| 47 | + * BeanDefinitionRegistryPostProcessor that searches recursively starting from a base package for interfaces |
47 | 48 | * and registers them as {@code MapperFactoryBean}. Note that only interfaces with at least one
|
48 | 49 | * method will be registered; concrete classes will be ignored.
|
49 | 50 | * <p>
|
|
79 | 80 | * @see MapperFactoryBean
|
80 | 81 | * @version $Id$
|
81 | 82 | */
|
82 |
| -public class MapperScannerConfigurer implements BeanFactoryPostProcessor, InitializingBean, ApplicationContextAware { |
| 83 | +public class MapperScannerConfigurer implements BeanDefinitionRegistryPostProcessor, InitializingBean, ApplicationContextAware { |
83 | 84 |
|
84 | 85 | private String basePackage;
|
85 | 86 |
|
@@ -137,7 +138,13 @@ public void afterPropertiesSet() throws Exception {
|
137 | 138 | * {@inheritDoc}
|
138 | 139 | */
|
139 | 140 | public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
|
140 |
| - Scanner scanner = new Scanner((BeanDefinitionRegistry) beanFactory); |
| 141 | + } |
| 142 | + |
| 143 | + /** |
| 144 | + * {@inheritDoc} |
| 145 | + */ |
| 146 | + public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry beanDefinitionRegistry) throws BeansException { |
| 147 | + Scanner scanner = new Scanner(beanDefinitionRegistry); |
141 | 148 | scanner.setResourceLoader(this.applicationContext);
|
142 | 149 |
|
143 | 150 | scanner.scan(StringUtils.tokenizeToStringArray(this.basePackage,
|
|
0 commit comments