Spring Tutorial Two: Bean Configuration in spring 1---XML file-based approach

Source: Internet
Author: User

I. Configuring beans in the Spring IOC container

    • To configure the bean through the bean node in the XML file

  

    • Name of Id:bean:

(1) must be unique within the IOC container

(2) If the ID is not specified, spring automatically assigns the permission qualifier class name to the Bean

(3) ID can specify more than one name, the name can be separated by commas, semicolons, or spaces

Second, spring container

    1. It must be initialized before the spring IOC container reads the bean configuration to create the bean instance. You can get the bean instance from the IOC container and use it only after the container is instantiated.
    2. Spring provides two types of IOC container implementations:

Basic implementation of BEANFACTORY:IOC container

ApplicationContext: Provides more advanced features and is a sub-interface of the beanfactory.

3. Beanfactory is the infrastructure of the spring framework for spring itself; ApplicationContext developers for the spring framework, In almost all applications, the applicationcontext is used directly rather than the underlying beanfactory

Third, ApplicationContext

1. ApplicationContext's main implementation class:

-classpathxmlapplicationcontext: Loading a configuration file from a Classpath

-filesystemxmlapplicationcontext: Loading configuration files from the file system

Spring Tutorial Two: Bean Configuration in spring 1---XML file-based approach

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.