i am just wondering what is the difference between @Inject & @Autowired
when to use each one ?, or they are doing the same thing ?
and if i have a spring bean which have a scope:
@Service
@Scope("singleton")
can i make dependency injection for it with both with no problems ?
thanks in advance.
From what I know, they do the same. @Inject is an annotation from javax.inject, which is only the API for dependency injection. In Spring you can use both, as I think Spring provides an implementation for @Inject which does the same thing as @Autowired in Spring environments.
Matthias Wessendorf blogged about this here: http://matthiaswessendorf.wordpress.com/2010/04/20/spring-3-0-and-jsr-330-part-2/