spring-data-rest-webmvc 2.0.0 - 缺少 RepositoryRestExporterServlet [英] spring-data-rest-webmvc 2.0.0 - RepositoryRestExporterServlet missing
问题描述
我正在尝试使用 spring-data-rest-webmvc 2.0.0 创建 REST Web 服务.我正在关注使用 1.0.0 版的手册Spring in Practice".在本手册中,它在 web.xml 中定义了导出器 servlet,如下所示:
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>
在 2.0.0 版本中,我找不到 RepositoryRestExporterServlet 类.我应该使用什么调度程序 servlet?我在哪里可以得到一些例子?谢谢
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
推荐答案
可以添加
<bean class="org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration"/>
到您的常规 spring-mvc-servlet.xml
配置,然后您可以同时使用 REST servlet 和 Spring MVC servlet.
To your regular spring-mvc-servlet.xml
config and then you can use both the REST servlet and Spring MVC servlet.
否则,对于 SDR 2,您应该使用:
Otherwise, for SDR 2, you should use:
org.springframework.data.rest.webmvc.RepositoryRestDispatcherServlet
在 web.xml
这篇关于spring-data-rest-webmvc 2.0.0 - 缺少 RepositoryRestExporterServlet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!