Overview

When a failure occurs while loading an ApplicationContext in the Spring TestContext Framework, it would be useful to have a first-class SPI for processing the exception.

For example, Spring Boot's testing support currently has a SpringBootDependencyInjectionTestExecutionListener that is responsible for generating a detailed failure report to help diagnose what went wrong; however, Spring Boot has to replace the standard DependencyInjectionTestExecutionListener with the Spring Boot specific one. In addition, the SpringBootDependencyInjectionTestExecutionListener has some drawbacks (see https://github.com/spring-projects/spring-boot/issues/24888).

We should therefor introduce a first-class SPI in the TestContext framework for "processing" ApplicationContext load failures -- basically a new interface that third parties like Spring Boot can implement and register (potentially via the spring.factories mechanism).

Related Issues

  • https://github.com/spring-projects/spring-boot/issues/24888
  • 14182

Comment From: wilkinsona

https://github.com/spring-projects/spring-boot/issues/31793 is tracking Boot making use of the new SPI.