-
Couldn't load subscription status.
- Fork 38.8k
Description
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:
- Apache Maven 3.2.3
- Java 1.8.0_45
- Ubuntu 14.04 LTS
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:
- Reconsider whether to generally allow bean overriding by name [SPR-10808] #15434 Reconsider whether to generally allow bean overriding by name
- context register @Configuration doesn't respect @Order [SPR-12657] #17257 context register
@Configurationdoesn't respect@Order