spring-data-rest-webmvc 2.0.0 - RepositoryRestExporterServlet missing

。_饼干妹妹 提交于 2019-12-23 03:48:10

问题


I'm trying to create a REST web service with spring-data-rest-webmvc 2.0.0. I'm following the handbook "Spring in Practice" where you use the version 1.0.0. In this handbook, it define the exporter servlet in web.xml as below:

<web-app ...>
    ...
    <servlet>
        <servlet-name>api</servlet-name>
        <servlet-class>org.springframework.data.rest.webmvc.RepositoryRestExporterServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>api</servlet-name>
        <url-pattern>/api/*</url-pattern>
    </servlet-mapping>
</web-app>

in version 2.0.0, I can not find the RepositoryRestExporterServlet class. What dispatcher servlet should I use? Where I can get some examples? Thanks


回答1:


You can add

 <bean class="org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration"/>

To your regular spring-mvc-servlet.xml config and then you can use both the REST servlet and Spring MVC servlet.

Otherwise, for SDR 2, you should use:

org.springframework.data.rest.webmvc.RepositoryRestDispatcherServlet

in web.xml



来源:https://stackoverflow.com/questions/22302593/spring-data-rest-webmvc-2-0-0-repositoryrestexporterservlet-missing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!