|
|
|
|
@ -101,7 +101,6 @@ import org.springframework.util.Assert;
@@ -101,7 +101,6 @@ import org.springframework.util.Assert;
|
|
|
|
|
import org.springframework.util.ClassUtils; |
|
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
import org.springframework.util.ObjectUtils; |
|
|
|
|
import org.springframework.util.ReflectionUtils; |
|
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
|
import org.springframework.util.function.ThrowingConsumer; |
|
|
|
|
import org.springframework.util.function.ThrowingSupplier; |
|
|
|
|
@ -179,6 +178,7 @@ import org.springframework.util.function.ThrowingSupplier;
@@ -179,6 +178,7 @@ import org.springframework.util.function.ThrowingSupplier;
|
|
|
|
|
* @author Chris Bono |
|
|
|
|
* @author Moritz Halbritter |
|
|
|
|
* @author Tadaya Tsuyukubo |
|
|
|
|
* @author Lasse Wulff |
|
|
|
|
* @author Yanming Zhou |
|
|
|
|
* @since 1.0.0 |
|
|
|
|
* @see #run(Class, String[]) |
|
|
|
|
@ -341,11 +341,7 @@ public class SpringApplication {
@@ -341,11 +341,7 @@ public class SpringApplication {
|
|
|
|
|
callRunners(context, applicationArguments); |
|
|
|
|
} |
|
|
|
|
catch (Throwable ex) { |
|
|
|
|
if (ex instanceof AbandonedRunException) { |
|
|
|
|
throw ex; |
|
|
|
|
} |
|
|
|
|
handleRunFailure(context, ex, listeners); |
|
|
|
|
throw new IllegalStateException(ex); |
|
|
|
|
throw handleRunFailure(context, ex, listeners); |
|
|
|
|
} |
|
|
|
|
try { |
|
|
|
|
if (context.isRunning()) { |
|
|
|
|
@ -353,11 +349,7 @@ public class SpringApplication {
@@ -353,11 +349,7 @@ public class SpringApplication {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
catch (Throwable ex) { |
|
|
|
|
if (ex instanceof AbandonedRunException) { |
|
|
|
|
throw ex; |
|
|
|
|
} |
|
|
|
|
handleRunFailure(context, ex, null); |
|
|
|
|
throw new IllegalStateException(ex); |
|
|
|
|
throw handleRunFailure(context, ex, null); |
|
|
|
|
} |
|
|
|
|
return context; |
|
|
|
|
} |
|
|
|
|
@ -806,8 +798,11 @@ public class SpringApplication {
@@ -806,8 +798,11 @@ public class SpringApplication {
|
|
|
|
|
.accept((R) runner); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void handleRunFailure(ConfigurableApplicationContext context, Throwable exception, |
|
|
|
|
private RuntimeException handleRunFailure(ConfigurableApplicationContext context, Throwable exception, |
|
|
|
|
SpringApplicationRunListeners listeners) { |
|
|
|
|
if (exception instanceof AbandonedRunException abandonedRunException) { |
|
|
|
|
return abandonedRunException; |
|
|
|
|
} |
|
|
|
|
try { |
|
|
|
|
try { |
|
|
|
|
handleExitCode(context, exception); |
|
|
|
|
@ -826,7 +821,8 @@ public class SpringApplication {
@@ -826,7 +821,8 @@ public class SpringApplication {
|
|
|
|
|
catch (Exception ex) { |
|
|
|
|
logger.warn("Unable to close ApplicationContext", ex); |
|
|
|
|
} |
|
|
|
|
ReflectionUtils.rethrowRuntimeException(exception); |
|
|
|
|
return (exception instanceof RuntimeException runtimeException) ? runtimeException |
|
|
|
|
: new IllegalStateException(exception); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private Collection<SpringBootExceptionReporter> getExceptionReporters(ConfigurableApplicationContext context) { |
|
|
|
|
|