class A{}
class B{}
class C{}
class Service{
private A a;
private B b;
private C c;
//setter&getter
}
对应下面的bean:
<beans>
<bean id="a" class="package.A">
</bean>
<bean id="b" class="package.B">
</bean>
<bean id="c" class="package.C">
</bean>
<bean id="service" class="package.Service">
<property name="a" ref="a"/>
<property name="b" ref="b"/>
<property name="c" ref="c"/>
</bean>
</beans>
这样就把A,B,C,Service都实例化完成了
可以直接
Service service=getService()了
A a=getService().getA()
class B{}
class C{}
class Service{
private A a;
private B b;
private C c;
//setter&getter
}
对应下面的bean:
<beans>
<bean id="a" class="package.A">
</bean>
<bean id="b" class="package.B">
</bean>
<bean id="c" class="package.C">
</bean>
<bean id="service" class="package.Service">
<property name="a" ref="a"/>
<property name="b" ref="b"/>
<property name="c" ref="c"/>
</bean>
</beans>
这样就把A,B,C,Service都实例化完成了
可以直接
Service service=getService()了
A a=getService().getA()