Skip to content

Commit 0ff511d

Browse files
author
Dave Syer
committed
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
1 parent 26a528c commit 0ff511d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

spring-boot/src/main/java/org/springframework/boot/SpringApplication.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ public ConfigurableApplicationContext run(String... args) {
330330
}
331331
return context;
332332
}
333-
catch (Exception ex) {
333+
catch (Throwable ex) {
334334
try {
335335
for (SpringApplicationRunListener runListener : runListeners) {
336336
finishWithException(runListener, context, ex);
@@ -696,7 +696,7 @@ protected void afterRefresh(ConfigurableApplicationContext context, String[] arg
696696
}
697697

698698
private void finishWithException(SpringApplicationRunListener runListener,
699-
ConfigurableApplicationContext context, Exception exception) {
699+
ConfigurableApplicationContext context, Throwable exception) {
700700
try {
701701
runListener.finished(context, exception);
702702
}

0 commit comments

Comments
 (0)