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

35.2. Spring MVC Integration


RESTEasy can also integrate with the Spring DispatcherServlet. This is advantageous because the web.xml is simpler, you can dispatch to either Spring controllers or RESTEasy from under the same base URL, and you can use Spring ModelAndView objects as return arguments from @GET resource methods. To set this up, you must use the Spring DispatcherServlet in your web.xml file, and import the springmvc-resteasy.xml file into your base Spring beans xml file. Here is an example web.xml file:
<web-app>
   <display-name>Archetype Created Web Application</display-name>

   <servlet>
      <servlet-name>Resteasy</servlet-name>
      <servlet-class>org.springframework.web.servlet.DispatcherServlet;</servlet-class>
   </servlet>

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


</web-app>
Copy to Clipboard Toggle word wrap
Then, within your main Spring beans xml file, import the springmvc-resteasy.xml file.
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
    http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
">

    <!-- Import basic SpringMVC Resteasy integration -->
    <import resource="classpath:springmvc-resteasy.xml"/>
....
Copy to Clipboard Toggle word wrap
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