@@ -231,7 +231,7 @@ protected void processConfigurationClass(ConfigurationClass configClass) throws
231
231
// Explicit bean definition found, probably replacing an import.
232
232
// Let's remove the old one and go with the new one.
233
233
this .configurationClasses .remove (configClass );
234
- for (Iterator <ConfigurationClass > it = this .knownSuperclasses .values ().iterator (); it .hasNext (); ) {
234
+ for (Iterator <ConfigurationClass > it = this .knownSuperclasses .values ().iterator (); it .hasNext ();) {
235
235
if (configClass .equals (it .next ())) {
236
236
it .remove ();
237
237
}
@@ -257,13 +257,16 @@ protected void processConfigurationClass(ConfigurationClass configClass) throws
257
257
* @param sourceClass a source class
258
258
* @return the superclass, or {@code null} if none found or previously processed
259
259
*/
260
- protected final SourceClass doProcessConfigurationClass (ConfigurationClass configClass , SourceClass sourceClass ) throws IOException {
260
+ protected final SourceClass doProcessConfigurationClass (ConfigurationClass configClass , SourceClass sourceClass )
261
+ throws IOException {
262
+
261
263
// Recursively process any member (nested) classes first
262
264
processMemberClasses (configClass , sourceClass );
263
265
264
266
// Process any @PropertySource annotations
265
267
for (AnnotationAttributes propertySource : AnnotationConfigUtils .attributesForRepeatable (
266
- sourceClass .getMetadata (), PropertySources .class , org .springframework .context .annotation .PropertySource .class )) {
268
+ sourceClass .getMetadata (), PropertySources .class ,
269
+ org .springframework .context .annotation .PropertySource .class )) {
267
270
if (this .environment instanceof ConfigurableEnvironment ) {
268
271
processPropertySource (propertySource );
269
272
}
@@ -276,14 +279,16 @@ protected final SourceClass doProcessConfigurationClass(ConfigurationClass confi
276
279
// Process any @ComponentScan annotations
277
280
Set <AnnotationAttributes > componentScans = AnnotationConfigUtils .attributesForRepeatable (
278
281
sourceClass .getMetadata (), ComponentScans .class , ComponentScan .class );
279
- if (!componentScans .isEmpty () && !this .conditionEvaluator .shouldSkip (sourceClass .getMetadata (), ConfigurationPhase .REGISTER_BEAN )) {
282
+ if (!componentScans .isEmpty () &&
283
+ !this .conditionEvaluator .shouldSkip (sourceClass .getMetadata (), ConfigurationPhase .REGISTER_BEAN )) {
280
284
for (AnnotationAttributes componentScan : componentScans ) {
281
285
// The config class is annotated with @ComponentScan -> perform the scan immediately
282
286
Set <BeanDefinitionHolder > scannedBeanDefinitions =
283
287
this .componentScanParser .parse (componentScan , sourceClass .getMetadata ().getClassName ());
284
- // Check the set of scanned definitions for any further config classes and parse recursively if necessary
288
+ // Check the set of scanned definitions for any further config classes and parse recursively if needed
285
289
for (BeanDefinitionHolder holder : scannedBeanDefinitions ) {
286
- if (ConfigurationClassUtils .checkConfigurationClassCandidate (holder .getBeanDefinition (), this .metadataReaderFactory )) {
290
+ if (ConfigurationClassUtils .checkConfigurationClassCandidate (
291
+ holder .getBeanDefinition (), this .metadataReaderFactory )) {
287
292
parse (holder .getBeanDefinition ().getBeanClassName (), holder .getBeanName ());
288
293
}
289
294
}
@@ -517,7 +522,9 @@ private Set<SourceClass> getImports(SourceClass sourceClass) throws IOException
517
522
* @param visited used to track visited classes to prevent infinite recursion
518
523
* @throws IOException if there is any problem reading metadata from the named class
519
524
*/
520
- private void collectImports (SourceClass sourceClass , Set <SourceClass > imports , Set <SourceClass > visited ) throws IOException {
525
+ private void collectImports (SourceClass sourceClass , Set <SourceClass > imports , Set <SourceClass > visited )
526
+ throws IOException {
527
+
521
528
if (visited .add (sourceClass )) {
522
529
for (SourceClass annotation : sourceClass .getAnnotations ()) {
523
530
String annName = annotation .getMetadata ().getClassName ();
@@ -544,7 +551,8 @@ private void processDeferredImportSelectors() {
544
551
throw ex ;
545
552
}
546
553
catch (Throwable ex ) {
547
- throw new BeanDefinitionStoreException ("Failed to process import candidates for configuration class [" +
554
+ throw new BeanDefinitionStoreException (
555
+ "Failed to process import candidates for configuration class [" +
548
556
configClass .getMetadata ().getClassName () + "]" , ex );
549
557
}
550
558
}
@@ -603,7 +611,8 @@ else if (candidate.isAssignable(ImportBeanDefinitionRegistrar.class)) {
603
611
throw ex ;
604
612
}
605
613
catch (Throwable ex ) {
606
- throw new BeanDefinitionStoreException ("Failed to process import candidates for configuration class [" +
614
+ throw new BeanDefinitionStoreException (
615
+ "Failed to process import candidates for configuration class [" +
607
616
configClass .getMetadata ().getClassName () + "]" , ex );
608
617
}
609
618
finally {
@@ -742,9 +751,9 @@ private static class DeferredImportSelectorHolder {
742
751
743
752
private final DeferredImportSelector importSelector ;
744
753
745
- public DeferredImportSelectorHolder (ConfigurationClass configurationClass , DeferredImportSelector importSelector ) {
746
- this .configurationClass = configurationClass ;
747
- this .importSelector = importSelector ;
754
+ public DeferredImportSelectorHolder (ConfigurationClass configClass , DeferredImportSelector selector ) {
755
+ this .configurationClass = configClass ;
756
+ this .importSelector = selector ;
748
757
}
749
758
750
759
public ConfigurationClass getConfigurationClass () {
@@ -878,8 +887,8 @@ public Set<SourceClass> getAnnotations() throws IOException {
878
887
return result ;
879
888
}
880
889
881
- public Collection <SourceClass > getAnnotationAttributes (String annotationType , String attribute ) throws IOException {
882
- Map <String , Object > annotationAttributes = this .metadata .getAnnotationAttributes (annotationType , true );
890
+ public Collection <SourceClass > getAnnotationAttributes (String annType , String attribute ) throws IOException {
891
+ Map <String , Object > annotationAttributes = this .metadata .getAnnotationAttributes (annType , true );
883
892
if (annotationAttributes == null || !annotationAttributes .containsKey (attribute )) {
884
893
return Collections .emptySet ();
885
894
}
0 commit comments