In this video, we are going to discuss about the @Autowired annotation .
Spring Annotation
Spring Boot Annotation
Constructor Injection
Setter Injection
Field Injection
- It is used for automatic dependency injection.
- Dependency Injection (DI) is a design pattern that removes the dependency from the programming code so that it can be easy to manage and test the application.
- Dependency Injection makes our programming code loosely coupled
- 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.- Advantage
- It requires the less code because we don't need to write the code to inject the dependency explicitly.
Негізгі бет @Autowired Annotation - Constructor/Setter/Field Injection - Spring Boot Annotations Series #2
Пікірлер: 2