Overview
The Javadoc of @BootstrapWith currently states:
This annotation may also be used as a meta-annotation to create custom composed annotations. Note, however, that a locally declared @BootstrapWith annotation (i.e., one that is directly present on the current test class) will override any meta-present declarations of @BootstrapWith.
However, if one tries to declare an annotation at the class level that overrides a declaration that is meta-annotated, this leads to:
Suppressed: java.lang.IllegalStateException: Configuration error: found multiple declarations of @BootstrapWith for test class [com.example.demo.DemoCustomTestBootstrapApplicationTests]: [@org.springframework.test.context.BootstrapWith(value=com.example.demo.CustomTestContextBootstrapper.class), @org.springframework.test.context.BootstrapWith(value=org.springframework.boot.test.context.SpringBootTestContextBootstrapper.class)]
at org.springframework.test.context.BootstrapUtils.resolveExplicitTestContextBootstrapper(BootstrapUtils.java:193)
at org.springframework.test.context.BootstrapUtils.resolveTestContextBootstrapper(BootstrapUtils.java:150)
at org.springframework.test.context.BootstrapUtils.resolveTestContextBootstrapper(BootstrapUtils.java:126)
at org.springframework.test.context.TestContextManager.<init>(TestContextManager.java:126)
at java.base/java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1916)
at org.springframework.test.context.junit.jupiter.SpringExtension.getTestContextManager(SpringExtension.java:427)
at org.springframework.test.context.junit.jupiter.SpringExtension.afterAll(SpringExtension.java:181)
With the following declaration:
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@SpringBootTest
@BootstrapWith(CustomTestContextBootstrapper.class)
public @interface CustomTest {
}
I am not sure if the Javadoc is wrong or if the use case above is meant to be supported. Knowing that will help figure out our options for spring-projects/spring-boot#15077.
Related Issues
Overview
The Javadoc of
@BootstrapWithcurrently states:However, if one tries to declare an annotation at the class level that overrides a declaration that is meta-annotated, this leads to:
With the following declaration:
I am not sure if the Javadoc is wrong or if the use case above is meant to be supported. Knowing that will help figure out our options for spring-projects/spring-boot#15077.
Related Issues