标签:静态 spring actor stat static 方式 user nbsp return
3.实例工厂
<bean id = "bean3Factory " class = "BeanFactory"/>
<bean id = "bean3" factory-bean="bean3Factory " factory-method="getUser"/>
类方法是
public class BeanFactory{
public User getUser()
{
return new User() ;
}
}
2.静态实例工厂
<bean id = "bean2" class = "" factory-method="getUser" />
类方法是
public class BeanFactory{
public static User getUser()
{
return new User() ;
}
}
1.无参构造方法实例化
<bean id = "user" class ="" />
java类必须有无参构造方法
标签:静态 spring actor stat static 方式 user nbsp return
原文地址:http://www.cnblogs.com/sj521/p/6385772.html