private Set<BeanDefinition> findKopBeanComponents(String basePackage){
boolean debugEnabled = logger.isDebugEnabled();
Set<BeanDefinition> candidates = new LinkedHashSet<BeanDefinition>();
List<String> classes = null;
if(basePackage.contains("com.linda.koala.biz.dao")){
classes = this.getDaoClasses();
}else if(basePackage.contains("com.linda.koala.biz")){
classes = this.getBizClasses();
}
if(classes!=null){
for(String clazz:classes){
ClassLoader loader = this.getClass().getClassLoader();
try {
Class<?> class1 = loader.loadClass(clazz);
if(class1!=null){
AnnotatedGenericBeanDefinition beanDefinition = new AnnotatedGenericBeanDefinition(class1);
if (isCandidateComponent(beanDefinition)) {
if (debugEnabled) {
logger.debug("Identified candidate component class: " + clazz);
}
candidates.add(beanDefinition);
}
else {
if (debugEnabled) {
logger.debug("Ignored because not a concrete top-level class: " +clazz);
}
}
}
} catch (ClassNotFoundException e) {
throw new BeanDefinitionStoreException("Failed to read candidate component class: " + clazz, e);
}
}
}
return candidates;
}
ClassPathScanningCandidateComponentProvider.java 文件源码
java
阅读 26
收藏 0
点赞 0
评论 0
项目:mybatis-spring-1.2.2
作者:
评论列表
文章目录