Regression: @Primary annotation not working when overriding bean definition with classpath scanning [SPR-12934] #17527
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: invalid
An issue that we don't feel is valid
Daniel Hiller opened SPR-12934 and commented
The
\@Primary
annotation seemed to stop working as expected since Spring 4.1.0.RELEASE (including 4.1.6.RELEASE) as demonstrated in this stripped down github repo.In the repository mentioned we created a stripped down version of our situation to demonstrate the problem. To get a quick start please have a look at the Application classes.
Run
mvn clean install && cd overridden-bean && mvn exec:java
for a demonstration. An execption should state that another bean type was expected.
NB: This looks like a regression as this is still working with latest Spring 4.0.9.RELEASE. Change the spring version in parent pom to 4.0.9.RELEASE, run the above command and see that it works as expected.
Versions used:
Interestingly, when trying to convert this into spring unit tests (see branch convert-to-unit-tests) and then running the tests from either Intellij vs. maven I get a non deterministic behavior (i.e. running from Intellij fails the test, while mvn clean install does not fail the tests)
Affects: 4.1 GA, 4.1.6
Issue Links:
@Configuration
doesn't respect@Order
The text was updated successfully, but these errors were encountered: