Spring學(xué)習(xí)心得(一)
1. BeanFactory是基本的bean工廠
2. 要想一個(gè)類實(shí)現(xiàn)bean工廠的功能,可以implements FactoryBean
3. 使用BeanFacory時(shí)一般使用ListableBeanFactory,它的實(shí)現(xiàn)類為XmlBeanFactory,需要傳遞Resource類,XmlBeanFactory(Resource resource)
4. Resource的實(shí)現(xiàn)類一般是FileSystemResource
5. 開(kāi)發(fā)中一般使用ApplicationContext,它的實(shí)現(xiàn)類可以是FileSystemXmlApplicationContext或ClassPathXmlApplicationContext,注意FileSystemXmlApplicationContext中需要注意src的問(wèn)題
6. bean的配置一般如下:
<bean id=”” class=””>
<property name=””>
<value></value>(<ref bean=””>)
</property>
v