Closed
Description
Sam Brannen opened SPR-17006 and commented
Status Quo
The resolution process for explicit TestContextBootstrapper
registration via @BootstrapWith
currently throws an IllegalStateException
if more than one declaration of @BootstrapWith
is detected.
As mentioned in Moduliths Issue #5, the resolution can be relaxed by checking the concrete types registered via @BootstrapWith
.
Proposals
- If multiple
@BootstrapWith
declarations are detected but each register the exact same type of boostrapper, no exception should occur. - If multiple
@BootstrapWith
declarations are detected and all types registered exist within the same class hierarchy, no exception should occur, and the most specific type should be used. - Otherwise, throw an
IllegalStateException
. - If
@BootstrapWith
is declared locally, directly on a test class, that declaration should override any such declarations that are meta-present.
Deliverables
- Proposal Spring core JMS pom.xml #1 already works.
- Consider implementing proposal Improve annotation processing thread-safety #2.
- Implement proposal SPR-7752 - EntityManager proxy now exposes provider specific interface. #4 (directly present annotation overrides meta-present annotations).
- Ensure that an exception is still thrown otherwise.
Affects: 4.3.10
Reference URL: moduliths/moduliths#5
Issue Links:
- Explicit failure if multiple @BootstrapWith annotations are used on the same test [SPR-12602] #17203 Explicit failure if multiple
@BootstrapWith
annotations are used on the same test