What is the use of Autowired annotation in spring?
Eleanor Gray
Updated on March 13, 2026
.
Similarly, you may ask, what is the use of @autowired in spring?
Autowiring feature of spring framework enables you to inject the object dependency implicitly. It internally uses setter or constructor injection. Autowiring can't be used to inject primitive and string values. It works with reference only.
Also Know, what is Autowiring in spring with examples? Spring looks for a bean with the same name as the property that needs to be autowired. For example, if a bean definition is set to autowire by name, and it contains a master property (that is, it has a setMaster(..) method), Spring looks for a bean definition named master, and uses it to set the property.
Similarly, it is asked, what is the use of Autowired annotation?
The @Autowired annotation provides more fine-grained control over where and how autowiring should be accomplished. The @Autowired annotation can be used to autowire bean on the setter method just like @Required annotation, constructor, a property or methods with arbitrary names and/or multiple arguments.
What are the annotations used in spring?
Some of the important Spring MVC annotations are:
- @Controller.
- @RequestMapping.
- @PathVariable.
- @RequestParam.
- @ModelAttribute.
- @RequestBody and @ResponseBody.
- @RequestHeader and @ResponseHeader.