|
|
|
@ -24,6 +24,7 @@ import java.util.Map;
|
|
|
|
|
import java.util.SortedMap;
|
|
|
|
|
import java.util.TreeMap;
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.BeanFactory;
|
|
|
|
|
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
|
|
|
|
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
|
|
|
|
@ -42,6 +43,8 @@ public class AutoConfigurationReport {
|
|
|
|
|
|
|
|
|
|
private final SortedMap<String, ConditionAndOutcomes> outcomes = new TreeMap<String, ConditionAndOutcomes>();
|
|
|
|
|
|
|
|
|
|
private AutoConfigurationReport parent;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Private constructor.
|
|
|
|
|
* @see #get(ConfigurableListableBeanFactory)
|
|
|
|
@ -70,6 +73,15 @@ public class AutoConfigurationReport {
|
|
|
|
|
return Collections.unmodifiableMap(this.outcomes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The parent report (from a parent BeanFactory if there is one).
|
|
|
|
|
*
|
|
|
|
|
* @return the parent report (or null if there isn't one)
|
|
|
|
|
*/
|
|
|
|
|
public AutoConfigurationReport getParent() {
|
|
|
|
|
return this.parent;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtain a {@link AutoConfigurationReport} for the specified bean factory.
|
|
|
|
|
* @param beanFactory the bean factory
|
|
|
|
@ -77,14 +89,24 @@ public class AutoConfigurationReport {
|
|
|
|
|
*/
|
|
|
|
|
public static AutoConfigurationReport get(ConfigurableListableBeanFactory beanFactory) {
|
|
|
|
|
synchronized (beanFactory) {
|
|
|
|
|
AutoConfigurationReport report;
|
|
|
|
|
try {
|
|
|
|
|
return beanFactory.getBean(BEAN_NAME, AutoConfigurationReport.class);
|
|
|
|
|
report = beanFactory.getBean(BEAN_NAME, AutoConfigurationReport.class);
|
|
|
|
|
}
|
|
|
|
|
catch (NoSuchBeanDefinitionException ex) {
|
|
|
|
|
AutoConfigurationReport report = new AutoConfigurationReport();
|
|
|
|
|
report = new AutoConfigurationReport();
|
|
|
|
|
beanFactory.registerSingleton(BEAN_NAME, report);
|
|
|
|
|
return report;
|
|
|
|
|
}
|
|
|
|
|
locateParent(beanFactory.getParentBeanFactory(), report);
|
|
|
|
|
return report;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void locateParent(BeanFactory beanFactory,
|
|
|
|
|
AutoConfigurationReport report) {
|
|
|
|
|
if (beanFactory != null && report.parent == null
|
|
|
|
|
&& beanFactory.containsBean(BEAN_NAME)) {
|
|
|
|
|
report.parent = beanFactory.getBean(BEAN_NAME, AutoConfigurationReport.class);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|