Solved

Annotation to do Dependency injection in spring

Posted on 2016-08-03
3
54 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 16

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
xampp tool 12 58
use lov values 2 71
Java exception bubble up 2 24
mysql jsp example issue 32 68
In this post we will learn different types of Android Layout and some basics of an Android App.
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 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 …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

685 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