• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 74
  • Last Modified:

Annotation to do Dependency injection in spring

HI,
Is there any other annotation apart from @Autowired to perform dependency injection in spring ?
Thanks
0
Rohit Bajaj
Asked:
Rohit Bajaj
3 Solutions
 
gurpsbassiCommented:
Use @Inject
0
 
mccarlIT Business Systems Analyst / Software DeveloperCommented:
There is also @Resource although it does operate slightly differently to the others. Check out the docs and also this blog post gives some useful info... http://blogs.sourceallies.com/2011/08/spring-injection-with-resource-and-autowired/
1
 
Jim CakalicSenior Developer/ArchitectCommented:
In addition to the big 3 mentioned in your question and previous comments, there are other annotations that compose the container configuration 'ecosystem'. The Spring Reference has useful information on Spring vs JSR-330 annotations in chapter 7, particularly sections 7.9 - 7.11.
Spring Framework Reference

In my experience, mixing and matching can be troublesome (similar to mixing Hibernate and JSR-338 annotations). I've found the most successful path is to pick one set that works for your project and stick with it. The decision will probably revolve around whether your application is meant to be JEE-compliant.

Regards,
Jim
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now