Understanding Spring-2.5 @Autowire @Inject @Qualifier @Named the same and different from the beginning

Source: Internet
Author: User

@Autowire @Inject

Same point:

The same can be injected into an object, injected in the domain above, injected on a set method or other method that needs to be injected, injected on the constructor

Different points:

@Autowire has a @required tag that allows the object to be empty

@Inject no @required tag, mandatory object cannot be empty


@Qualifier @Named

Same point:

is used as a qualifier, you can use either the tag or the bean's ID to qualify


Summary: This chapter mainly introduces the similarities and differences between the @autowire @Inject @Qualifier @Named.


Catalog: http://blog.csdn.net/raylee2007/article/details/50611627

My github:https://github.com/raylee2015/my_new_spring.


Understanding Spring-2.5 @Autowire @Inject @Qualifier @Named the same and different from the beginning

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.