Java Spring Boot Annotations and Dependencies | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Java Spring Boot Annotations and Dependencies

Hey everyone. I have a question about annotations in Spring Boot. I’ve never used them before, I know @Controller/@RestController, @RequestMapping/@GetMapping, but that’s not enough to build a good functional web project using Spring Boot. What means the @Autowired annotation at all? I read about it a lot, but I don’t understand how to use dependency injection still. So, the main thing I should learn is dependency injection perhaps?

29th Aug 2021, 2:51 PM
Paul.
Paul. - avatar
1 Answer
+ 2
The @Autowired annotation is used to inject the object dependency internally. You need not instantiate an object everytime using the 'new' keyword. This is generally achieved through either setter or constructor injection. The IoC container is responsible for creating and managing your objects.
29th Aug 2021, 3:28 PM
Avinesh
Avinesh - avatar