Difference between @Resource and @Autowired

Original link: https://www.lifengdi.com/archives/transport/3890

The two annotations @Resource and @Autowired are used to implement Bean dependency injection in the Spring ecosystem. Let’s talk about the two annotations @Autowired and @Resource respectively. Flashed [@Autowired’s role detailed explanation] a few words. First of all, @Autowired is an annotation provided in Spring. By default, Bean dependency injection is implemented according to the type. There is a required attribute in the @Autowired annotation. The default value is true, which means that the injection of the bean instance is mandatory. When the application starts, if the corresponding type of bean does not exist in the IOC container, an error will be reported. certainly, […]

This article is reproduced from: https://www.lifengdi.com/archives/transport/3890
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment

Your email address will not be published.