Friday, January 11, 2013

@Resource, @Inject and @Autowired

@Resource is from JSR250 (Common Annotations for Java), when you write an app on Java EE platform, you can use @Resource to get reference from the container, like DataSource or SipFactory (from Sip Servlet) or something else you defined in your container. @Inject, it totally for DI, from JSR330 (Dependency Injection for Java). In Spring application, @Reource and @Inject and @Autowired are similar, but out of Spring, it will be another story.

No comments:

Post a Comment