Closed
Description
Dave Syer opened SPR-7106 and commented
AbstractApplicationContext.close() could be more forgiving of exceptions. Since it is often called in a finally block, technically it should be used like this:
try {
context.refresh()
} finally {
try {
context.close();
} catch (Exception e) {
// swallow or log it
}
}
If you don't catch and log/swallow you never get to see the exceptions thrown by context.refresh() (which are more interesting since they happen first).
This never used to happen in my code until Spring 3.0, at which point LifecycleProcessor will sometimes throw an exception (e.g. especially if context.refresh() has failed). There is a catch and log in there, but it only applies to quite a small block, so I assume that was adequate until the lifecycle procressor came along.
Affects: 3.0 GA