Difference between @Inject and @Autowired

Difference between @Inject and @Autowired

Difference between @Inject and @Autowired

This is one of the important interview question of spring / spring boot framework interviews. Auto-wiring is the great feature we got to wire our application dependencies spring way, but it can be done by both JSR annotation and spring provided annotation. It is important to know the difference between these both to make use of it effectively in real time use-cases.


  • Does not have ‘required’ attribute
  • Throws exception if the dependency not found.
  • Java/Sun Provided annotation (JSR 330)
  • Default bean scope is prototype.



  • Has ‘required’ attribute
  • Exception can be avoided when no dependency found by setting required attribute to false.
  • Spring provided annotation.
  • Default bean scope is singleton.

428 total views, 1 views today

Leave a Reply

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