Piotr Findeisen opened SPR-11027 and commented
According to docs, @Autowired setter should not be called when an explicit value is set in XML context configuration.
Unfortunately, the AutowiredAnnotationBeanPostProcessor.injectionMetadataCache cache is per Class, but it's contents, especially AutowiredMethodElement.skip attribute (inherited by AutowiredMethodElement from superclass) is specific bean definition dependent.
As a result, if I have two unrelated beans of the same class, they 'share' their autowiring behavior.
- an unlucky bean using
@Autowired may have its setter not called at all
- an unlucky bean providing explicit value for
@Autowired setter may have its setter called twice
- depending on the order in which beans are initialized.
Affects: 3.1.2, 3.1.4, 3.2.4
Referenced from: commits ce001c2, 4675bc4, 393cfcf