Este conteúdo não está disponível no idioma selecionado.

13.16. RESTEasy/Spring Integration


13.16.1. RESTEasy/Spring integration

Prerequisites

  • Your application must have an existing JAX-WS service and client configuration.

Procedure 13.9. Enable the RESTEasy/Spring integration functionality

  • RESTEasy integrates with Spring 3.0.x.
    Maven users must use the resteasy-spring artifact. Alternatively, the jar is available as a module in JBoss EAP 6.
    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.This means that RESTEasy will automatically scan for @Provider and JAX-RS resource annotations on your bean class and register them as JAX-RS resources.

    Example 13.24. Edit web.xml

    Add the following to your web.xml file to enable the RESTEasy/Spring integration functionality:
    <web-app>
    	<display-name>
    			Archetype Created Web Application
    	</display-name>
    	<listener>
       	<listener-class>
       		org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap
      	</listener-class>
    	</listener>
    
    	<listener>
    	  <listener-class>
      	 		org.jboss.resteasy.plugins.spring.SpringContextLoaderListener
       	</listener-class>
    	</listener>
    
    	<servlet>
      	<servlet-name>Resteasy
      	</servlet-name>
      		<servlet-class>
      			org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
      		</servlet-class>
    	</servlet>
    
    	<servlet-mapping>
      	<servlet-name>
      		Resteasy
      	</servlet-name>
      	<url-pattern>/*</url-pattern>
    	</servlet-mapping>
    </web-app>
    
    
    Copy to Clipboard Toggle word wrap
    The SpringContextLoaderListener must be declared after ResteasyBootstrap as it uses ServletContext attributes initialized by it.
For more information regarding RestEasy and Spring integration, see http://docs.jboss.org/resteasy/docs/2.3.7.Final/userguide/html_single/
Voltar ao topo
Red Hat logoGithubredditYoutubeTwitter

Aprender

Experimente, compre e venda

Comunidades

Sobre a documentação da Red Hat

Ajudamos os usuários da Red Hat a inovar e atingir seus objetivos com nossos produtos e serviços com conteúdo em que podem confiar. Explore nossas atualizações recentes.

Tornando o open source mais inclusivo

A Red Hat está comprometida em substituir a linguagem problemática em nosso código, documentação e propriedades da web. Para mais detalhes veja o Blog da Red Hat.

Sobre a Red Hat

Fornecemos soluções robustas que facilitam o trabalho das empresas em plataformas e ambientes, desde o data center principal até a borda da rede.

Theme

© 2025 Red Hat