1

spring-data-rest-webmvc 2.0.0 で REST Web サービスを作成しようとしています。バージョン1.0.0を使用するハンドブック「Spring in Practice」に従っています。このハンドブックでは、以下のように web.xml でエクスポーター サーブレットを定義します。

<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 クラスが見つかりません。どのディスパッチャ サーブレットを使用すればよいですか? 例をどこで入手できますか? ありがとう

4

1 に答える 1

1

あなたは付け加えられます

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

通常spring-mvc-servlet.xmlの構成にすると、REST サーブレットと Spring MVC サーブレットの両方を使用できます。

それ以外の場合、SDR 2 の場合は次を使用する必要があります。

org.springframework.data.rest.webmvc.RepositoryRestDispatcherServlet

web.xml

于 2014-03-10T18:58:25.363 に答える