The difference between ApplicationContext and beanfactory containers in spring

Source: Internet
Author: User

The difference between ApplicationContext and beanfactory containers in spring: These two containers are different for the time when the beans are created:

ApplicationContext context = new Classpathxmlapplicationcontext ("Applicationcontext.xml");
1) When the ApplicationContext container is initialized, all of its beans (objects) are created
Cons: Consumes system resources (memory, CPU, etc.)
Advantages: Fast response times

Beanfactory factory=newxmlbeanfactory (New Classpathresource ("Applicationcontext.xml"));
2) objects in the Beanfactory container are not created when the container is initialized, but are created when the object is actually acquired
Cons: Relatively speaking, slow response times
Pros: Not much use of system resources

In general development is commonly used for the ApplicationContext container to load the spring configuration file, because with the development of hardware resources, memory is secondary, the response speed can make the user experience better!

The difference between ApplicationContext and beanfactory containers in spring

Related Article

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.