You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#12483 is a nice start, but it didn't go far enough for me (I think).
Spring now supports overrides of "parent" annotation attributes (through its meta data representation utilities introduced in conjunction with #14814). The Spring TestContext Framework, however, is not yet taking advantage of this feature. So for instance you can annotate a custom annotation with @ContextConfiguration, but there's no way for the user of that annotation to provide their own context configuration locations (e.g. classes=...).
Deliverables
Support meta-annotation attribute overrides for the following annotations within the context of the TestContext framework.
@ContextConfiguration
@WebAppConfiguration
@ContextHierarchy
@ActiveProfiles
@DirtiesContext
@TestExecutionListeners
@IfProfileValue
@ProfileValueSourceConfiguration
@Transactional
@BeforeTransaction
@AfterTransaction
@TransactionConfiguration
@Rollback
@Repeat
@Timed
Notes
AnnotatedElementUtils does not support overrides for the 'value' attribute of an annotation. It is therefore not possible or not feasible to support meta-annotation attribute overrides for some test-related annotations.
Support for meta-annotation attribute overrides for @Transactional was already supported via SpringTransactionAnnotationParser.
@BeforeTransaction and @AfterTransaction do not have attributes.
@ContextHierarchy, @WebAppConfiguration, @Rollback, @Repeat, and @ProfileValueSourceConfiguration only have single 'value' attributes which cannot be overridden via Spring's meta-annotation attribute support.
Although @IfProfileValue has 'values' and 'name' attributes, the typical usage scenario involves the 'value' attribute which is not supported for meta-annotation attribute overrides. Furthermore, 'name' and 'values' are so generic that it is deemed unfeasible to provide meta-annotation attribute override support for these.
Dave Syer opened SPR-11038 and commented
Overview
#12483 is a nice start, but it didn't go far enough for me (I think).
Spring now supports overrides of "parent" annotation attributes (through its meta data representation utilities introduced in conjunction with #14814). The Spring TestContext Framework, however, is not yet taking advantage of this feature. So for instance you can annotate a custom annotation with
@ContextConfiguration, but there's no way for the user of that annotation to provide their own context configuration locations (e.g.classes=...).Deliverables
Support meta-annotation attribute overrides for the following annotations within the context of the TestContext framework.
@ContextConfiguration@WebAppConfiguration@ContextHierarchy@ActiveProfiles@DirtiesContext@TestExecutionListeners@IfProfileValue@ProfileValueSourceConfiguration@Transactional@BeforeTransaction@AfterTransaction@TransactionConfiguration@Rollback@Repeat@TimedNotes
@Transactionalwas already supported via SpringTransactionAnnotationParser.@BeforeTransactionand@AfterTransactiondo not have attributes.@ContextHierarchy,@WebAppConfiguration,@Rollback,@Repeat, and@ProfileValueSourceConfigurationonly have single 'value' attributes which cannot be overridden via Spring's meta-annotation attribute support.@IfProfileValuehas 'values' and 'name' attributes, the typical usage scenario involves the 'value' attribute which is not supported for meta-annotation attribute overrides. Furthermore, 'name' and 'values' are so generic that it is deemed unfeasible to provide meta-annotation attribute override support for these.Affects: 4.0 RC1
Issue Links:
Referenced from: commits 64f593d, c7c395d