?
Solved

Annotation to do Dependency injection in spring

Posted on 2016-08-03
3
Medium Priority
?
59 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 16

Assisted Solution

by:gurpsbassi
gurpsbassi earned 400 total points
ID: 41742160
Use @Inject
0
 
LVL 36

Accepted Solution

by:
mccarl earned 1200 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 400 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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses
Course of the Month14 days, 22 hours left to enroll

771 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