-1
需要在靜態工廠方法中傳遞參數,並且想要創建spring bean - 如何o請幫助。彈簧框架 - 如何在靜態工廠方法中傳遞參數
需要在靜態工廠方法中傳遞參數,並且想要創建spring bean - 如何o請幫助。彈簧框架 - 如何在靜態工廠方法中傳遞參數
給予參數到一個工廠方法(通過XML配置)被描述here,重要的是(另見文檔static factory methods)...
public class DaoFactoryCreator {
public static DaoFactory createDaoFactory(List daos) {
... this is the factory method, do something here and return it
}
}
<bean id="daoFactory" class="com.javalobby.tnt.spring.DaoFactoryCreator" factory-method="createDaoFactory" />
<constructor-arg>
<value>
<list>
<ref bean="dao1"/>
<ref bean="dao2"/>
<ref bean="dao3"/>
</list>
</value>
</constructor-arg>
</bean>