标签:工厂方法 yun 静态 efault create conf bean def com
<bean id="a" class="com.yundaex.wms.config.TestBeanChild" /> <bean id="b" class="com.yundaex.wms.config.TestBeanChild" factory-bean="a" factory-method="createDefault" />
public class TestBeanChild { int b = 1; public TestBeanDefault createDefault() { return new TestBeanDefault(); } }
public class TestBeanDefault { int b=2; }
静态工厂方法
public class TestBeanChild { int b = 1; public static TestBeanDefault createDefault() { return new TestBeanDefault(); } }
<bean id="a" class="com.yundaex.wms.config.TestBeanChild" /> <bean id="b" class="com.yundaex.wms.config.TestBeanChild" factory-method="createDefault" />
标签:工厂方法 yun 静态 efault create conf bean def com
原文地址:http://www.cnblogs.com/tonggc1668/p/7497974.html