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
#14865 and #16004 proposed support for using @PropertySource on test classes and introducing @TestPropertyValue for declarative PropertySource value declarations, respectively. This issue supersedes those two issues by combining the two proposals into a dedicated @TestPropertySource annotation.
Deliverables
Introduce a new @TestPropertySource annotation for configuring a test-specific PropertySource.
@TestPropertySource must support attributes analogous to those found in @PropertySource (i.e., for declaring resource locations).
@TestPropertySource must support an additional attribute that allows for key/value pairs to be declared inline.
As with @ActiveProfiles, @TestPropertySource declarations on test classes should be inherited by default but overridable via a boolean flag (i.e., attribute in the annotation).
The context cache key (i.e., MergedContextConfiguration) must take test property sources into account.
Sam Brannen opened SPR-12051 and commented
Status Quo
#14865 and #16004 proposed support for using
@PropertySourceon test classes and introducing@TestPropertyValuefor declarativePropertySourcevalue declarations, respectively. This issue supersedes those two issues by combining the two proposals into a dedicated@TestPropertySourceannotation.Deliverables
@TestPropertySourceannotation for configuring a test-specificPropertySource.@TestPropertySourcemust support attributes analogous to those found in@PropertySource(i.e., for declaring resource locations).@TestPropertySourcemust support an additional attribute that allows for key/value pairs to be declared inline.valueattribute in@IntegrationTestfrom Spring Boot for implementation ideas.@ActiveProfiles,@TestPropertySourcedeclarations on test classes should be inherited by default but overridable via a boolean flag (i.e., attribute in the annotation).MergedContextConfiguration) must take test property sources into account.Further Resources
ConfigurationClassParser.processPropertySource(AnnotationAttributes)Issue Links:
@TestPropertySourcesupport in the reference manual ("is depended on by")@PropertySourceto be specified on a test class ("supersedes")Referenced from: commits f2ac025, 2cf4147
1 votes, 3 watchers