Configuration of Bean for 5.Spring series 2

Source: Internet
Author: User

One, two ways to configure beans using the XML configuration Bean

Automatic assembly of 1.Bean

the ①.spring IOC container can automatically assemble beans. The only thing you need to do is to specify the automatic assembly mode in the <bean> autowire attribute.②.bytype (automatically assembled by type): If there are multiple beans in the IOC container that are consistent with the target bean type. In this case, Spring will not be able to determine which bean is most suitable for this property, so automatic assembly cannot be performed.③.byname (Auto-assemble by name): The name and property name of the target Bean must be set exactly the same.④.constructor (automatically assembled via the constructor): This automatic assembly method is complex when there are multiple constructors in the Bean. deprecated

Configuration of Bean for 5.Spring series 2

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.