@ -75,14 +75,12 @@ class EnableAutoConfigurationImportSelector implements DeferredImportSelector,
+ " annotated with @EnableAutoConfiguration?" ) ;
// Find all possible auto configuration classes, filtering duplicates
List < String > factories = new ArrayList < String > ( new LinkedHashSet < String > (
SpringFactoriesLoader . loadFactoryNames ( EnableAutoConfiguration . class ,
this . beanClassLoader ) ) ) ;
List < String > factories = getFactories ( attributes ) ;
// Remove those specifically excluded
Set < String > excluded = new LinkedHashSet < String > ( ) ;
excluded . addAll ( Arrays. asList ( attributes . getStringArray ( "exclude" ) ) ) ;
excluded . addAll ( Arrays. asList ( attributes . getStringArray ( "excludeName" ) ) ) ;
excluded . addAll ( asList( attributes , "exclude" ) ) ;
excluded . addAll ( asList( attributes , "excludeName" ) ) ;
excluded . addAll ( getExcludeAutoConfigurationsProperty ( ) ) ;
factories . removeAll ( excluded ) ;
ConditionEvaluationReport . get ( this . beanFactory ) . recordExclusions ( excluded ) ;
@ -100,6 +98,20 @@ class EnableAutoConfigurationImportSelector implements DeferredImportSelector,
}
}
private List < String > getFactories ( AnnotationAttributes attributes ) {
List < String > factories = asList ( attributes , "include" ) ;
if ( factories . isEmpty ( ) ) {
factories = SpringFactoriesLoader . loadFactoryNames (
EnableAutoConfiguration . class , this . beanClassLoader ) ;
}
return new ArrayList < String > ( new LinkedHashSet < String > ( factories ) ) ;
}
private List < String > asList ( AnnotationAttributes attributes , String name ) {
String [ ] value = attributes . getStringArray ( name ) ;
return Arrays . asList ( value = = null ? new String [ 0 ] : value ) ;
}
private List < String > getExcludeAutoConfigurationsProperty ( ) {
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver ( this . environment ,
"spring.autoconfigure." ) ;