Spring Load Bean
1. The implementation is implemented through the IOC container,
2. The core beanfactory and ApplicationContext beanfactory of the IOC container are the containers that initialize, configure, and manage beans,
Xmlbeanfactory can implement the function method of the Beanfactory interface, which is implemented by the constructor's parameter injection.
3. Methods of Beanfactory
Getbean (String beanname) Getbean (string s, Class Class1), Containsbean (string s); Issingletonbean (string s); Isprototype (string s); GetType (string s);
4. ApplicationContext is a sub-interface of the beanfactory, called the application context,
In addition to creating and managing beans, there are other features, such as internationalization. The singleton Bean can also be initialized, which occurs when the container is initialized,
When the ApplicationContext container is initialized, the singleton bean is initialized and does not need to be initialized separately,
5. Ways to get contextual information
Classpathxmlapplicationcontext ("/bean.xml"); Gets the context from the XML file of the class load path
Filesystemxmlapplicationcontext ("D:/app/bean.xml"); Get context from the file system's XML file
Xmlwebapplicationcontext ("/bean.xml"); Gets the context from the XML file of the WEB system (Webroot/web-inf/bean.xml)
Spring Load Bean