users@jersey.java.net

Jersey-Spring and correct annotation

From: Patrick Dreyer <Patrick_at_Dreyer.name>
Date: Fri, 12 Feb 2010 11:47:46 +0100

Hi everyone

The information and examples found about annotations related to
Jersey-Spring are very confusing, as there is no source explaining when
to use which annotation and why.
Probably, most of the "confusion" comes out of the different versions of
Jersey, Spring and Jersey-Spring. What I'm looking for is the correct
use of annotations for

* JRE 1.6.0_18-b07
* Jersey 1.1.5
* Spring 3.0.0-RELEASE
* Jersey-Spring 1.1.5

Examples I found specify Jersey resources like:

@Path("...")
@Component @Scope("request")
public class RootResource { ... }

Others use:

@Path("...")
@PerRequest
@Component @Scope("request")
public class RootResource { ... }

Or even an other alternative found:

@Path("...")
@PerRequest
public class RootResource { ... }

Same goes for fields to be injected:

@Inject private Task task;

But others use:

@Autowire private Task task;


Regards
---
Patrick Dreyer