Solved

Annotation to do Dependency injection in spring

Posted on 2016-08-03
3
37 Views
Last Modified: 2016-08-13
HI,
Is there any other annotation apart from @Autowired to perform dependency injection in spring ?
Thanks
0
Comment
Question by:Rohit Bajaj
3 Comments
 
LVL 15

Assisted Solution

by:gurpsbassi
gurpsbassi earned 100 total points
ID: 41742160
Use @Inject
0
 
LVL 35

Accepted Solution

by:
mccarl earned 300 total points
ID: 41742213
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
 
LVL 19

Assisted Solution

by:Jim Cakalic
Jim Cakalic earned 100 total points
ID: 41742340
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

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn how to implement Singleton Design Pattern in Java.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now