Springが参照されるBeanを注入する方法に違いはありますか?
MyClass.java
public class MyClass {
@Inject
@Named("myNiceBean")
private MyBean bean;
public MyBean getBean() { return bean; }
public void setBean(MyBean bean) { this.bean = bean; }
}
ApplicationContext.xml
<bean id="myNiceBean" class="com.exemple.DummyBean" />
と
public class MyClass {
private MyBean bean;
public MyBean getBean() { return bean; }
public void setBean(MyBean bean) { this.bean = bean; }
}
ApplicationContext.xml
<bean id="myNiceBean" class="com.exemple.DummyBean" />
<bean id="myClass" class="com.exemple.MyClass">
<property name="bean" ref="myNiceBean"/>
</bean>