Spring Load Bean

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.