spring-framework icon indicating copy to clipboard operation
spring-framework copied to clipboard

Introduce SPI for processing ApplicationContext failures in the TestContext framework

Open sbrannen opened this issue 3 years ago • 1 comments

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

sbrannen avatar Jul 15 '22 08:07 sbrannen

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

wilkinsona avatar Jul 19 '22 14:07 wilkinsona