2015-12-30 55 views

回答

0

給予參數到一個工廠方法(通過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>