@Resource is even better ! JEE5 compliant and Spring non intrusive code.
@Inject
@Autowired
I don't use either.
@Resource is even better ! JEE5 compliant and Spring non intrusive code.
I prefer @Autowired
Autowired has always worked for me, it's clean, simple, and does exactly what I need it to.
Paul
Find Spring Consultants at java316.com
@Autowired can be configured to NOT require the injection, therefore it is more functional and flexible than @Inject. So, I always use @Autowired, and I am not concerned about being tied to Spring... C'mon people, are you serious?![]()
Autowiring is fine up to a point:
- where contexts are small, self-contained and isolated
- when starting out and wanting to take defaults
However, with large systems with lots of config where you have to do things like re-use resources or use classpath* and/or imports then you can lose control of what's going on. As soon as you have to start using qualifiers you're going against the grain of autowiring anyway.
Admittedly, the above situations speak of poor layout, design and control of configuration. The config can and does get this way very quickly.
Autowiring does a good job and I'm often tempted to use it but when it breaks it's tough to sort out whereas being explicit rarely has these problems.
i prefer @Inject i have used it for a long time
Paul
I voted for @Autowired
Julia
@Resource seems to be better & JSR compliant
1. @Resource
2. @Autowired couple with Qualifier (sometimes . )
i voted also.
gar