What's the difference between Beanfactory and ApplicationContext?

Source: Internet
Author: User

Beanfactory can be understood as a factory class that contains bean collections. Beanfactory contains the definition of a bean to instantiate the corresponding bean when a client request is received.
Beanfactory can also generate relationships between collaboration classes when instantiating an object. This frees the bean itself from the configuration of the Bean client. The beanfactory also contains the Bean lifecycle control, the invocation of the client's initialization method (initialization methods), and the Destruction method (destruction methods).
On the surface, application context, like Bean factory, has a bean definition, bean affinity setting, and the ability to distribute beans on request. However, the application context also provides other features on this basis.

    1. Provides a text message that supports internationalization
    2. Unified resource File Read mode
    3. Events for beans that have been registered in the listener
      Here are three more common ways to implement ApplicationContext:
      1. Classpathxmlapplicationcontext: Reads the context from the classpath XML configuration file and generates a context definition. The application context is obtained from the program environment variable.
      ApplicationContext context = new Classpathxmlapplicationcontext ("Bean.xml");
      2. Filesystemxmlapplicationcontext: The context is read by the XML configuration file in the file system.
      ApplicationContext context = new Filesystemxmlapplicationcontext ("Bean.xml");
      3. Xmlwebapplicationcontext: The context is read by the Web application's XML file.

What's the difference between Beanfactory and ApplicationContext?

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.