Ensure startup error is logged (and rethrown)

Fixes gh-948
This commit is contained in:
Dave Syer 2014-05-26 09:21:27 +01:00
parent 32295b9bdc
commit 0938a874ad
1 changed files with 9 additions and 6 deletions

View File

@ -324,17 +324,20 @@ public class SpringApplication {
return context; return context;
} }
catch (Exception ex) { catch (Exception ex) {
try {
for (SpringApplicationRunListener runListener : runListeners) { for (SpringApplicationRunListener runListener : runListeners) {
finishWithException(runListener, context, ex); finishWithException(runListener, context, ex);
} }
this.log.error("Application startup failed", ex);
}
finally {
if (context != null) { if (context != null) {
context.close(); context.close();
} }
}
ReflectionUtils.rethrowRuntimeException(ex); ReflectionUtils.rethrowRuntimeException(ex);
return context; return context;
} }
finally {
}
} }
private Collection<SpringApplicationRunListener> getRunListeners(String[] args) { private Collection<SpringApplicationRunListener> getRunListeners(String[] args) {