Affects: 5.3.10
with Java 11
I know that Spring Framework has a special relationship in regards to injecting Maps. I have a JUnit test where I am encountering a strange injection behavior, though.
See JUnit test case: https://github.com/ghillert/spring-di-with-maps/blob/main/src/test/java/com/hillert/spring/maps/AutowiredMapInjectionTests.java
I am declaring a single bean of type Map<String, Object>
(used by 2 tests) that gets injected using @Autowired
and @Qualifier("myMapBean")
annotations. Both tests use the same autowired dependency of the map but the injected value of the dependency is different. The second test should see the injected bean, as does the first test, NOT the value of the underlying map. Thus, when I change the execution order of the tests, they will both fail. Is this somehow expected behavior or possibly an issue?
Comment From: snicoll
It's odd but I can't reproduce it with a recent JDK. Sorry this got overlooked.
Comment From: SpiReCZ
@snicoll Might be worth checking the linked issue.