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
Spring Framework 4.1 introduced TestPropertySourceUtils for working with @TestPropertySource; however, the utilities in this class are package private.
In light of requirements from Spring Boot (and potentially other third-party frameworks), it would be beneficial to make such utilities public so that the logic contained in them can be reused outside the spring-test module.
Deliverables
Make TestPropertySourceUtils public.
Make utility methods in TestPropertySourceUtils public as appropriate.
Open up TestPropertySourceUtils for public consumption
Spring Framework 4.1 introduced support for @TestPropertySource;
however, the utilities used to parse inlined properties and add test
property sources to the environment are currently private which
prevents reuse by third-party frameworks like Spring Boot.
This commit addresses this issue by making such utilities public.
TestPropertySourceUtils is now a public class.
Various utility methods in TestPropertySourceUtils have been made
public.
addResourcePropertySourcesToEnvironment() has been renamed to
addPropertiesFilesToEnvironment().
extractEnvironmentProperties() has been renamed to
convertInlinedPropertiesToMap().
All public methods in TestPropertySourceUtils are now fully
documented.
Further refinements in GitHub commits 42af330 (4.2) and d98f626 (4.1.5):
Make TestPropertySourceUtils more robust
Added assertions for pre-conditions on method arguments for all
public utility methods.
Introduced additional tests in TestPropertySourceUtilsTests to verify
the new pre-conditions.
Introduced INLINED_PROPERTIES_PROPERTY_SOURCE_NAME constant for the
name of the MapPropertySource created from inlined properties; the
name therefore no longer contains the inlined properties, but the
original values of the inlined properties can now be logged at debug
level.
Simplified tests in InlinedPropertiesTestPropertySourceTests.
Sam Brannen opened SPR-12721 and commented
Status Quo
Spring Framework 4.1 introduced
TestPropertySourceUtils
for working with@TestPropertySource
; however, the utilities in this class are package private.In light of requirements from Spring Boot (and potentially other third-party frameworks), it would be beneficial to make such utilities public so that the logic contained in them can be reused outside the
spring-test
module.Deliverables
TestPropertySourceUtils
public.TestPropertySourceUtils
public as appropriate.Affects: 4.1 GA
Issue Links:
@TestPropertySource
The text was updated successfully, but these errors were encountered: