New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support simultaneous use of classes and locations in @ContextConfiguration [SPR-11634] #16257
Comments
Abhijit Sarkar commented Should this really be a "minor" improvement? I'm sure lot of people will appreciate this change, more so as the ways to configure the application increases from XML, to Java, to Groovy. What's the point of providing different ways if someone is forced to use just one? |
Sam Brannen commented
Spring has never forced you to use just one. Historically, it has never been possible to instantiate an Now, having said that, it is possible to instantiate a For further information on how to load bean definitions from different resource types in a conventional manner, please see the Mixing XML resources and annotated classes section of the reference manual. Here's an excerpt:
The key thing to take away here is that you want the Regards, Sam |
Sam Brannen commented Completed as described in the comments for GitHub commit 8e89aff:
|
Sam Brannen commented Backported to Spring 4.0.4 in GitHub commit 989f619. |
Abhijit Sarkar commented Tested with 4.0.4.BUILD-SNAPSHOT, the following works: (y)
|
Sam Brannen commented Great! Thanks for verifying it. |
Dave Syer opened SPR-11634 and commented
Background
It should be up to a
SmartContextLoader
to decide if it supports bothclasses
andlocations
. Historically there was noApplicationContext
that supported both XML resources and annotated classes (so you had to choose one as an entry point). That isn't the case any longer since Spring Boot doesn't care much what it eats.Deliverables
IllegalArgumentException
in the constructor inContextConfigurationAttributes
if bothlocations
andclasses
are supplied.locations
andclasses
cannot be used simultaneously.ContextConfigurationAttributes
,@ContextConfiguration
, etc.locations
andclasses
cannot be used simultaneously.Affects: 4.0.3
Referenced from: commits 8e89aff, 989f619, 1f017c4
The text was updated successfully, but these errors were encountered: