Christian Hersevoort opened SPR-14179 and commented
The case is as follows:
Beans:
- MyParentBean
- MyChildBeanA implements MyChildBean
- MyChildBeanB implements MyChildBean
XML configuration:
<bean id="myChildBeanA" class="com.hersevoort.java.test.MyChildBeanA">
</bean>
<bean id="myChildBeanB" class="com.hersevoort.java.test.MyChildBeanB">
</bean>
<bean id="myParentBean" class="com.hersevoort.java.test.MyParentBean">
<property name="myChild" ref="myChildBeanB"/>
</bean>
Case #1: This works:
public class MyParentBean
{
private MyChildBean myChild;
@Inject
public void setMyChild(MyChildBean myChild)
{
this.myChild = myChild;
}
}
Case #2: This doesn't work:
public class MyParentBean
{
@Inject
private MyChildBean myChild;
}
I expect Spring to handle both cases exactly the same, but Case #2 throws an unexpected NoUniqueBeanDefinitionException. (see attachment)
Am I wrong to assume this is a bug?
Affects: 4.2.1, 4.2.5, 4.3 RC1
Attachments:
Issue Links:
Christian Hersevoort opened SPR-14179 and commented
The case is as follows:
Beans:
XML configuration:
Case #1: This works:
Case #2: This doesn't work:
I expect Spring to handle both cases exactly the same, but Case #2 throws an unexpected NoUniqueBeanDefinitionException. (see attachment)
Am I wrong to assume this is a bug?
Affects: 4.2.1, 4.2.5, 4.3 RC1
Attachments:
Issue Links:
@Configurationmark@Injectfields and setters as satisfied (injected)?