tags:

views:

693

answers:

3

I see some are using Jersey w/ Spring. With Spring 3.0 there are now annotations available to make RESTful APIs directly in a controller. Why should I consider using Jersey w/ Spring?

+1  A: 

Jersey pros:

  • comes with specifications JSR 311
  • reference implementation for JSR 311
  • Restlet and RESTeasy are other implementations for JSR 311
  • better tooling (at least on Netbeans)
  • it is integrated with Spring and Guice

EDIT

A (very nice) Comparison of Spring MVC and JAX-RS

dfa
ok, but what do I get over using Spring 3.0 w/ annotations? How does Jersey make my life easier before I dive in and learn something new. :-/
jr
standard annotations? and better tooling
dfa
Thanks! So, when using it with spring you are really just using Spring for the IoC functionality, etc? The controller will actually be a Jersey implementation? Hopefully I am understanding this correctly.
jr
Can you even use Jersey with Spring 3.0?
jr
check out jersey-spring: https://jersey.dev.java.net/nonav/apidocs/latest/contribs/jersey-spring/index.html
dfa
A: 

Spring 3 is backwards compatible so you can use Jersey.

What you get is not tying your application to a propietary API.

Jeduan Cornejo
I tried to use Spring 3.0, but had some strange dependency issues I didn't feel like tracking down, so went back to 2.5.6.SEC01 and I am now fine. I'm sure I could have gotten it to work, but didn't think I needed anything from 3.0. So, I think I get it now. You can simply annotate the objects using the standard Java annotations for REST and then later change architectures. By using Spring you get all the benefits of the IoC and applicationContext to manage your objects. So, it kind of is the best of both. I have a working solution so far..
jr
A: 

I integrated our Jersey project with Spring, but just for dependency-injection stuff and some other things. We're still using Jersey's service front-end, not Spring's MVC.

gmoore