1.
beanfactory create beans in three ways :
1.通过构造函数
2.通过静态工厂 factory-method
3.通过实例工厂方法(non-static) factory-method ,factory-bean, and the attribute class must be null
2.
spring 中XMLBeanFactory中的bean如果定义了class属性,那么这个bean就能被实例化。而且XMLBeanFactory
会默认地将signleton的bean预实例化,所以,如果你想要把一个bean 仅仅作为模版不用实例化,那么你最好把这个
bean 的lazy-init设置为true 或者 把它设置为 non-singleton,or it will been instanced by the container and
result to some error .
3.
how to get the factorybean :
use the method getBean("xxx") will return the bean in the xml files , but when you want to
get the beanfactory ,how to get it ? very simple , just add a "&" like getBean("&xxx") .
4.
用方法调用的返回值来设置bean的属性
MethodInvokingFactoryBean