Monday, February 15, 2010

Exposing RESTful APIs with JAX-RS on Spring

JAX-RS is the way to expose RESTful APIs using Java.

Since JAX-RS is a standard/specification, several implementations exist:
All of them should work with Spring, making it easy for you to use Spring dependency injection and other goodies with JAX-RS methods.

Don't forget to mark the JAX-RS beans as @Scope("request") because REST APIs should be stateless.

There's nothing forbidding you to use Singleton or other scoping though.