Browse Source

Ensure parent context of bootstrap context is closed.

fixes gh-267
pull/498/head
Spencer Gibb 7 years ago
parent
commit
abe5374c79
No known key found for this signature in database
GPG Key ID: 7788A47380690861
  1. 15
      spring-cloud-context/src/main/java/org/springframework/cloud/context/refresh/ContextRefresher.java

15
spring-cloud-context/src/main/java/org/springframework/cloud/context/refresh/ContextRefresher.java

@ -105,7 +105,20 @@ public class ContextRefresher { @@ -105,7 +105,20 @@ public class ContextRefresher {
}
finally {
ConfigurableApplicationContext closeable = capture;
closeable.close();
while (closeable != null) {
try {
closeable.close();
}
catch (Exception e) {
// Ignore;
}
if (closeable.getParent() instanceof ConfigurableApplicationContext) {
closeable = (ConfigurableApplicationContext) closeable.getParent();
}
else {
break;
}
}
}
}

Loading…
Cancel
Save