Catch Throwable instead of Exception in Spring Application
...so that application startup that fails because of an Error (for instance NoClassDefFoundError) won't be swallowed. Fixes gh-1645
This commit is contained in:
parent
26a528ce95
commit
0ff511d978
|
|
@ -330,7 +330,7 @@ public class SpringApplication {
|
||||||
}
|
}
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Throwable ex) {
|
||||||
try {
|
try {
|
||||||
for (SpringApplicationRunListener runListener : runListeners) {
|
for (SpringApplicationRunListener runListener : runListeners) {
|
||||||
finishWithException(runListener, context, ex);
|
finishWithException(runListener, context, ex);
|
||||||
|
|
@ -696,7 +696,7 @@ public class SpringApplication {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void finishWithException(SpringApplicationRunListener runListener,
|
private void finishWithException(SpringApplicationRunListener runListener,
|
||||||
ConfigurableApplicationContext context, Exception exception) {
|
ConfigurableApplicationContext context, Throwable exception) {
|
||||||
try {
|
try {
|
||||||
runListener.finished(context, exception);
|
runListener.finished(context, exception);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue