1,资源类
image.png
image.png
2,静态工厂实例化(很少用)
image.png
<bean id="testComponent" class="com.hzq.TestComponentFactory"
factory-method="getTestComponent">
</bean>
2,实例工厂实例化(很少用)
image.png
<bean id="testComponentFactory" class="com.hzq.TestComponentFactory"></bean>
<bean id="testComponent" factory-bean="testComponentFactory" factory-method="getTestComponent"></bean>
3,无参构造函数实例化
<bean id="testComponent" class="com.lianjia.businessHubLoan.TestComponent"></bean>
4,有参构造函数实例化
<bean id="testService" class="com.lianjia.businessHubLoan.TestService">
<constructor-arg index="0" name="component" value="testComponent"></constructor-arg>
</bean>
网友评论