JBossWiki : RESTeasySpringIntegration
Wiki Home: RESTeasySpringIntegration [EN]
[Permalink]
[Recent Changes]
[History]
[RSS Feed][RDF Feed][Atom Feed][Print]

RESTEasy Spring Integration

RESTEasy integrates with Spring 2.5. We are interested in other forms of Spring integration, so please help contribute.

RESTeasy comes with its own Spring ContextLoaderListener that registers a RESTeasy specific BeanPostProcessor that processes JAX-RS annotations when a bean is created by a BeanFactory?. What does this mean? RESTeasy will automatically scan for @Provider and JAX-RS resource annotations on your bean class and register them as JAX-RS resources.

<web-app>
   <display-name>Archetype Created Web Application</display-name>

   <listener>
      <listener-class>org.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
   </listener>

   <listener>
      <listener-class>org.resteasy.plugins.server.servlet.SpringContextLoaderListener</listener-class>
   </listener>

   <servlet>
      <servlet-name>Resteasy</servlet-name>
      <servlet-class>org.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
   </servlet>

   <servlet-mapping>
      <servlet-name>Resteasy</servlet-name>
      <url-pattern>/*</url-pattern>
   </servlet-mapping>


</web-app>

The SpringContextLoaderListener? must be declared after ResteasyBootstrap? as it uses ServletContext? attributes initialized by it.

If you do not use a Spring ContextLoaderListener? to create your bean factories, then you can manually register the RESTeasy BeanPostProcessor? by allocating an instance of org.resteasy.plugins.server.servlet.SpringBeanProcessor?. You can obtain instances of a ResteasyProviderFactory? and Registry from the ServletContext? attributes org.resteasy.spi.ResteasyProviderFactory? and org.resteasy.spi.Registry. (Really the string FQN of these classes)


Other languages:

Log in to make links between pages

The page last changed on Tue Jun 03 01:24:42 EDT 2008 by bill.burke@jboss.com