基于setter方法的依赖注入
基于setter方法的依赖注入,容器通过调用bean的setter方法完成注入,bean通过构造器或静态工厂方法完成实例化。
<bean id="exampleBean" class="examples.ExampleBean">
<!-- setter injection using the nested ref element -->
<property name="beanOne">
<ref bean="anotherExampleBean"/>
</property>
<!-- setter injection using the neater ref attribute -->
<property name="beanTwo" ref="yetAnotherBean"/>
<property name="integerProperty" value="1"/>
</bean>
<bean id="anotherExa