java - Annotation based Spring / JAX-RS integration with no web.xml - Stack Overflow
You can integrate Spring and Jersey in a XML-less mode.
You will need to extend the class com.sun.jersey.spi.spring.container.servlet.SpringServlet
. e.g.:
package org.test; import com.sun.jersey.spi.spring.container.servlet.SpringServlet; import javax.servlet.annotation.WebInitParam; import javax.servlet.annotation.WebServlet; @WebServlet(urlPatterns = {"/rest/*"}, initParams = { @WebInitParam(name = "com.sun.jersey.config.property.packages", value = "org.test.rest")}) public class JerseyServlet extends SpringServlet { }
Actually, it is a servlet. The parameter com.sun.jersey.config.property.packages
indicates where scanning the resources (classes with annotation @Path
).
Read full article from java - Annotation based Spring / JAX-RS integration with no web.xml - Stack Overflow
No comments:
Post a Comment