What is the difference between @Inject and @Autowired

I'm just wondering what is the difference between @Inject and @Autowired when to use each of them? or are they doing the same thing?

and if I have spring bean that have scope:

@Service
@Scope("singleton")

Can I do dependency injection for both without problems?

early.

+5
source share
5 answers

, , . @Inject - javax.inject, API . Spring , , Spring @Inject, , @Autowired Spring.

: http://matthiaswessendorf.wordpress.com/2010/04/20/spring-3-0-and-jsr-330-part-2/

+7

?

JSR 330 @ Spring@ . @Inject Spring @ , , . , JAR 330 JAR CLASSPATH.

+6

, , @Autowired, Spring, @Inject , JSR 330.

+2

1) @Inject - javax.inject Java.

2) @Autowired. org.springframework.bean.factory Spring.

0

, @Autowired Spring Framework, @Inject "Injection Injection for Java" (JSR-330) "

, @Inject , , - bean, , @Autowired = false .

. @Inject , , , @Inject . Provider , , bean bean.

0

All Articles