|
|
@ -27,8 +27,7 @@ import org.springframework.core.type.classreading.MetadataReaderFactory;
|
|
|
|
import org.springframework.core.type.filter.TypeFilter;
|
|
|
|
import org.springframework.core.type.filter.TypeFilter;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* A {@link TypeFilter} implementation that matches registered auto-configuration
|
|
|
|
* A {@link TypeFilter} implementation that matches registered auto-configuration classes.
|
|
|
|
* classes.
|
|
|
|
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @author Stephane Nicoll
|
|
|
|
* @author Stephane Nicoll
|
|
|
|
* @since 1.5.0
|
|
|
|
* @since 1.5.0
|
|
|
@ -37,7 +36,7 @@ public class AutoConfigurationExcludeFilter implements TypeFilter, BeanClassLoad
|
|
|
|
|
|
|
|
|
|
|
|
private ClassLoader beanClassLoader;
|
|
|
|
private ClassLoader beanClassLoader;
|
|
|
|
|
|
|
|
|
|
|
|
private List<String> candidateAutoConfigurations;
|
|
|
|
private volatile List<String> autoConfigurations;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void setBeanClassLoader(ClassLoader beanClassLoader) {
|
|
|
|
public void setBeanClassLoader(ClassLoader beanClassLoader) {
|
|
|
@ -50,22 +49,22 @@ public class AutoConfigurationExcludeFilter implements TypeFilter, BeanClassLoad
|
|
|
|
return isConfiguration(metadataReader) && isAutoConfiguration(metadataReader);
|
|
|
|
return isConfiguration(metadataReader) && isAutoConfiguration(metadataReader);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected List<String> getCandidateAutoConfigurations() {
|
|
|
|
|
|
|
|
if (this.candidateAutoConfigurations == null) {
|
|
|
|
|
|
|
|
this.candidateAutoConfigurations = SpringFactoriesLoader.loadFactoryNames(
|
|
|
|
|
|
|
|
EnableAutoConfiguration.class, this.beanClassLoader);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return this.candidateAutoConfigurations;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean isConfiguration(MetadataReader metadataReader) {
|
|
|
|
private boolean isConfiguration(MetadataReader metadataReader) {
|
|
|
|
return metadataReader.getAnnotationMetadata()
|
|
|
|
return metadataReader.getAnnotationMetadata()
|
|
|
|
.isAnnotated(Configuration.class.getName());
|
|
|
|
.isAnnotated(Configuration.class.getName());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private boolean isAutoConfiguration(MetadataReader metadataReader) {
|
|
|
|
private boolean isAutoConfiguration(MetadataReader metadataReader) {
|
|
|
|
return getCandidateAutoConfigurations().contains(
|
|
|
|
return getAutoConfigurations()
|
|
|
|
metadataReader.getClassMetadata().getClassName());
|
|
|
|
.contains(metadataReader.getClassMetadata().getClassName());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected List<String> getAutoConfigurations() {
|
|
|
|
|
|
|
|
if (this.autoConfigurations == null) {
|
|
|
|
|
|
|
|
this.autoConfigurations = SpringFactoriesLoader.loadFactoryNames(
|
|
|
|
|
|
|
|
EnableAutoConfiguration.class, this.beanClassLoader);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return this.autoConfigurations;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|