|
|
|
@ -183,7 +183,7 @@ class ConfigurationClassParser { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void processConfigurationClass(ConfigurationClass configClass) throws IOException { |
|
|
|
protected void processConfigurationClass(ConfigurationClass configClass) throws IOException { |
|
|
|
if (shouldSkip(asSourceClass(configClass), ConfigurationPhase.PARSE_CONFIGURATION)) { |
|
|
|
if (this.conditionEvaluator.shouldSkip(configClass.getMetadata(), ConfigurationPhase.PARSE_CONFIGURATION)) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -201,7 +201,6 @@ class ConfigurationClassParser { |
|
|
|
// Recursively process the configuration class and its superclass hierarchy.
|
|
|
|
// Recursively process the configuration class and its superclass hierarchy.
|
|
|
|
SourceClass sourceClass = asSourceClass(configClass); |
|
|
|
SourceClass sourceClass = asSourceClass(configClass); |
|
|
|
do { |
|
|
|
do { |
|
|
|
configClass.addMetadataHierarchy(sourceClass.getMetadata()); |
|
|
|
|
|
|
|
sourceClass = doProcessConfigurationClass(configClass, sourceClass); |
|
|
|
sourceClass = doProcessConfigurationClass(configClass, sourceClass); |
|
|
|
} |
|
|
|
} |
|
|
|
while (sourceClass != null); |
|
|
|
while (sourceClass != null); |
|
|
|
@ -231,7 +230,7 @@ class ConfigurationClassParser { |
|
|
|
AnnotationAttributes componentScan = AnnotationConfigUtils.attributesFor(sourceClass.getMetadata(), ComponentScan.class); |
|
|
|
AnnotationAttributes componentScan = AnnotationConfigUtils.attributesFor(sourceClass.getMetadata(), ComponentScan.class); |
|
|
|
if (componentScan != null) { |
|
|
|
if (componentScan != null) { |
|
|
|
// the config class is annotated with @ComponentScan -> perform the scan immediately
|
|
|
|
// the config class is annotated with @ComponentScan -> perform the scan immediately
|
|
|
|
if (!shouldSkip(sourceClass, ConfigurationPhase.REGISTER_BEAN)) { |
|
|
|
if (!conditionEvaluator.shouldSkip(sourceClass.getMetadata(), ConfigurationPhase.REGISTER_BEAN)) { |
|
|
|
Set<BeanDefinitionHolder> scannedBeanDefinitions = |
|
|
|
Set<BeanDefinitionHolder> scannedBeanDefinitions = |
|
|
|
this.componentScanParser.parse(componentScan, sourceClass.getMetadata().getClassName()); |
|
|
|
this.componentScanParser.parse(componentScan, sourceClass.getMetadata().getClassName()); |
|
|
|
|
|
|
|
|
|
|
|
@ -270,7 +269,12 @@ class ConfigurationClassParser { |
|
|
|
if (!this.knownSuperclasses.containsKey(superclass)) { |
|
|
|
if (!this.knownSuperclasses.containsKey(superclass)) { |
|
|
|
this.knownSuperclasses.put(superclass, configClass); |
|
|
|
this.knownSuperclasses.put(superclass, configClass); |
|
|
|
// superclass found, return its annotation metadata and recurse
|
|
|
|
// superclass found, return its annotation metadata and recurse
|
|
|
|
return sourceClass.getSuperClass(); |
|
|
|
try { |
|
|
|
|
|
|
|
return sourceClass.getSuperClass(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
catch (ClassNotFoundException ex) { |
|
|
|
|
|
|
|
throw new IllegalStateException(ex); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -278,17 +282,6 @@ class ConfigurationClassParser { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private boolean shouldSkip(SourceClass sourceClass, ConfigurationPhase phase) |
|
|
|
|
|
|
|
throws IOException { |
|
|
|
|
|
|
|
while (sourceClass != null) { |
|
|
|
|
|
|
|
if (conditionEvaluator.shouldSkip(sourceClass.getMetadata(), phase)) { |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
sourceClass = sourceClass.getSuperClass(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Register member (nested) classes that happen to be configuration classes themselves. |
|
|
|
* Register member (nested) classes that happen to be configuration classes themselves. |
|
|
|
* @param sourceClass the source class to process |
|
|
|
* @param sourceClass the source class to process |
|
|
|
@ -699,19 +692,11 @@ class ConfigurationClassParser { |
|
|
|
return members; |
|
|
|
return members; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public SourceClass getSuperClass() throws IOException { |
|
|
|
public SourceClass getSuperClass() throws IOException, ClassNotFoundException { |
|
|
|
if (!getMetadata().hasSuperClass()) { |
|
|
|
if (this.source instanceof Class<?>) { |
|
|
|
return null; |
|
|
|
return asSourceClass(((Class<?>) this.source).getSuperclass()); |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
if (this.source instanceof Class<?>) { |
|
|
|
|
|
|
|
return asSourceClass(((Class<?>) this.source).getSuperclass()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return asSourceClass(((MetadataReader) this.source).getClassMetadata().getSuperClassName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
catch (ClassNotFoundException ex) { |
|
|
|
|
|
|
|
throw new IllegalStateException(ex); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return asSourceClass(((MetadataReader) this.source).getClassMetadata().getSuperClassName()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Set<SourceClass> getAnnotations() throws IOException, ClassNotFoundException { |
|
|
|
public Set<SourceClass> getAnnotations() throws IOException, ClassNotFoundException { |
|
|
|
|