From 2c4808760431dc8e26cdc31407626ce25783a0bd Mon Sep 17 00:00:00 2001 From: Danny Thomas Date: Thu, 15 Jun 2017 14:56:45 -0700 Subject: [PATCH] Ensure SpringBootDITEL fails with the original failure See gh-9534 --- ...otDependencyInjectionTestExecutionListener.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/SpringBootDependencyInjectionTestExecutionListener.java b/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/SpringBootDependencyInjectionTestExecutionListener.java index 5b3fcbd0fc..90d186d325 100644 --- a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/SpringBootDependencyInjectionTestExecutionListener.java +++ b/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/SpringBootDependencyInjectionTestExecutionListener.java @@ -44,11 +44,15 @@ public class SpringBootDependencyInjectionTestExecutionListener super.prepareTestInstance(testContext); } catch (Exception ex) { - ApplicationContext context = testContext.getApplicationContext(); - if (context instanceof ConfigurableApplicationContext) { - ConditionEvaluationReport report = ConditionEvaluationReport - .get(((ConfigurableApplicationContext) context).getBeanFactory()); - System.err.println(new ConditionEvaluationReportMessage(report)); + try { + ApplicationContext context = testContext.getApplicationContext(); + if (context instanceof ConfigurableApplicationContext) { + ConditionEvaluationReport report = ConditionEvaluationReport + .get(((ConfigurableApplicationContext) context).getBeanFactory()); + System.err.println(new ConditionEvaluationReportMessage(report)); + } + } + catch (Exception ignore) { } throw ex; }