Skip to content

Commit

Permalink
DUBBO-408 Spring2.0兼容问题
Browse files Browse the repository at this point in the history
git-svn-id: http://code.alibabatech.com/svn/dubbo/trunk@1830 1a56cb94-b969-4eaa-88fa-be21384802f2
  • Loading branch information
william.liangf committed May 22, 2012
1 parent 859acc0 commit b27149a
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;
Expand Down Expand Up @@ -77,11 +77,16 @@ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
if (annotationPackage == null || annotationPackage.length() == 0) {
return;
}
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner((DefaultListableBeanFactory) beanFactory);
scanner.addIncludeFilter(new AnnotationTypeFilter(Service.class));
String[] pkgs = Constants.COMMA_SPLIT_PATTERN.split(annotationPackage);
for (String pkg : pkgs) {
scanner.scan(pkg);
if (beanFactory instanceof BeanDefinitionRegistry) {
try {
Class.forName("org.springframework.context.annotation.ClassPathBeanDefinitionScanner", true, Thread.currentThread().getContextClassLoader());
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner((BeanDefinitionRegistry) beanFactory);
scanner.addIncludeFilter(new AnnotationTypeFilter(Service.class));
String[] pkgs = Constants.COMMA_SPLIT_PATTERN.split(annotationPackage);
scanner.scan(pkgs);
} catch (ClassNotFoundException e) {
// spring 2.0
}
}
}

Expand Down

0 comments on commit b27149a

Please sign in to comment.