Solved

Annotation to do Dependency injection in spring

Posted on 2016-08-03
3
58 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 100 total points
ID: 41742160
Use @Inject
0
 
LVL 36

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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
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…
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:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

717 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