-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed
Labels
in: testIssues in the test moduleIssues in the test moduletype: enhancementA general enhancementA general enhancement
Milestone
Description
Sam Brannen opened SPR-8386 and commented
Status Quo
The current ContextLoader SPI has the following shortcomings:
- it only supports String-based resource locations, but we need first-class support for Class-based resources for
@Configurationclasses - it does not support the notion of bean definition profiles that were introduced in Spring 3.1 M1
Deliverables
- Introduce a new
SmartContextLoaderSPI that extendsContextLoaderand supports both String[] and Class[] resources, likely retrieved from a new "context" parameter object as opposed to hard-coded, inflexible method signatures. This will replace the need forResourceTypeAwareContextLoaderand itsResourceTypeenum, and it will result in a more flexible SPI that is better suited to support future, unknown requirements. - Refactor existing
AnnotationConfigContextLoader,ContextLoaderUtils, andTestContextimplementations to take advantage of theSmartContextLoaderSPI - Delete
ResourceTypeAwareContextLoader - Delete
ContextLoaderUtils.LocationsResolverand implementations
Implementation Notes Regarding Profiles
Design the SmartContextLoader SPI so that a reference to the configured active profiles can be passed to a variant of loadContext(). This reference may potentially take the form of the "context" parameter object introduced with the new SmartContextLoader SPI. See AbstractGenericContextLoader's loadContext() method for an example of where the profiles would need to be set in the code (i.e., prior to refreshing the context).
Affects: 3.1 M2
Issue Links:
- Provide TestContext support for @Configuration classes [SPR-6184] #10852 Provide TestContext support for
@Configurationclasses ("depends on") - TestContext framework should support declarative configuration of bean definition profiles [SPR-7960] #12615 TestContext framework should support declarative configuration of bean definition profiles ("is depended on by")
- Introduce a DelegatingSmartContextLoader [SPR-8387] #13034 Introduce a DelegatingSmartContextLoader ("is depended on by")
Metadata
Metadata
Assignees
Labels
in: testIssues in the test moduleIssues in the test moduletype: enhancementA general enhancementA general enhancement