Which annotation is used to inject a bean dependency into a Spring component?

  • @Autowired
  • @Bean
  • @Component
  • @Inject
The @Autowired annotation is used to inject a bean dependency into a Spring component. It enables automatic injection of dependencies by type. When a bean of the required type is available in the Spring context, it will be injected into the annotated field or constructor parameter. This annotation simplifies the process of wiring components together in a Spring application.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *