Explain the difference between @autowired and @inject?



Explain the difference between @autowired and @inject?..

Answer / Ravinder Rawat

"@Autowired" is a Spring Framework annotation used for Dependency Injection in Java. It automatically injects the dependency based on the type matching between the field, method parameter, or constructor argument, with a bean in the Spring ApplicationContext.nnOn the other hand, "@Inject" is a generic Dependency Injection annotation that can be used in various Java frameworks including CDI (Contexts and Dependency Injection for the Java EE platform) and Google Guice. Spring Framework also supports @Inject but it's not as widely used as @Autowired because of its more verbose syntax and lesser integration with Spring."

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Spring Framework Interview Questions

Does spring boot require tomcat? : Spring Boot

1 Answers  


What is stateful and stateless bean in spring?

1 Answers  


What do you mean by beanfactory in spring?

1 Answers  


What is the use of @qualifier in spring boot? : Spring Boot

1 Answers  


What is spring security?

1 Answers  


What is a spring mvc?

1 Answers  


What is jpa and spring data jpa?

1 Answers  


How struts application can be integrated with spring?

1 Answers  


Explain what is spring mvc?

1 Answers  


In how many ways, can one configure spring into an application?

1 Answers  


What is spring framework beginner?

1 Answers  


What is aop module?

1 Answers  


Categories