ConditionEvaluationReportListener Class — spring-boot Architecture
Architecture documentation for the ConditionEvaluationReportListener class in ConditionEvaluationReportLoggingListener.java from the spring-boot codebase.
Entity Profile
Relationship Graph
Source Code
core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportLoggingListener.java lines 87–146
private final class ConditionEvaluationReportListener implements GenericApplicationListener {
private final ConfigurableApplicationContext context;
private final ConditionEvaluationReportLogger logger;
private ConditionEvaluationReportListener(ConfigurableApplicationContext context) {
this.context = context;
Supplier<ConditionEvaluationReport> reportSupplier;
if (context instanceof GenericApplicationContext) {
// Get the report early when the context allows early access to the bean
// factory in case the context subsequently fails to load
ConditionEvaluationReport report = getReport();
reportSupplier = () -> report;
}
else {
reportSupplier = this::getReport;
}
this.logger = new ConditionEvaluationReportLogger(ConditionEvaluationReportLoggingListener.this.logLevel,
reportSupplier);
}
private ConditionEvaluationReport getReport() {
return ConditionEvaluationReport.get(this.context.getBeanFactory());
}
@Override
public int getOrder() {
return Ordered.LOWEST_PRECEDENCE;
}
@Override
public boolean supportsEventType(ResolvableType resolvableType) {
Class<?> type = resolvableType.getRawClass();
if (type == null) {
return false;
}
return ContextRefreshedEvent.class.isAssignableFrom(type)
|| ApplicationFailedEvent.class.isAssignableFrom(type);
}
@Override
public boolean supportsSourceType(@Nullable Class<?> sourceType) {
return true;
}
@Override
public void onApplicationEvent(ApplicationEvent event) {
if (event instanceof ContextRefreshedEvent contextRefreshedEvent) {
if (contextRefreshedEvent.getApplicationContext() == this.context) {
this.logger.logReport(false);
}
}
else if (event instanceof ApplicationFailedEvent applicationFailedEvent
&& applicationFailedEvent.getApplicationContext() == this.context) {
this.logger.logReport(true);
}
}
}
Domain
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free