ContextCloserListener Class — spring-boot Architecture
Architecture documentation for the ContextCloserListener class in ParentContextCloserApplicationListener.java from the spring-boot codebase.
Entity Profile
Source Code
core/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextCloserApplicationListener.java lines 82–117
protected static class ContextCloserListener implements ApplicationListener<ContextClosedEvent> {
private final WeakReference<ConfigurableApplicationContext> childContext;
public ContextCloserListener(ConfigurableApplicationContext childContext) {
this.childContext = new WeakReference<>(childContext);
}
@Override
public void onApplicationEvent(ContextClosedEvent event) {
ConfigurableApplicationContext context = this.childContext.get();
if ((context != null) && (event.getApplicationContext() == context.getParent()) && context.isActive()) {
context.close();
}
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (obj instanceof ContextCloserListener other) {
return ObjectUtils.nullSafeEquals(this.childContext.get(), other.childContext.get());
}
return super.equals(obj);
}
@Override
public int hashCode() {
return ObjectUtils.nullSafeHashCode(this.childContext.get());
}
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free