0

正常に動作する既存の mvc アプリケーションがありますが、追加すると

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

spring-data-rest を有効にしてから、経由で提供される静的リソースを有効にします

<mvc:resources mapping="/resources/**" location="/resources/" />

アクセスできません。実際、静的リソースをリクエストすると、ログにこれが表示されます

2013-06-06 15:33:21,035 DEBUG DispatcherServlet.doService(823) - DispatcherServlet with name 'eips-databus' processing GET request for [/eips-databus/scripts/easyUI/themes/gray/easyui_custom.css]
2013-06-06 15:33:21,035 DEBUG RequestMappingHandlerMapping.getHandlerInternal(226) - Looking up handler method for path /scripts/easyUI/themes/gray/easyui_custom.css
2013-06-06 15:33:21,035 DEBUG ExceptionHandlerExceptionResolver.resolveException(132) - Resolving exception from handler [null]: org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation

何かアドバイス?前もって感謝します

4

1 に答える 1

0

私はいくつかの違いで同じに直面しています。私の場合、静的リソースのハンドラーを追加します。

@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
    registry.addResourceHandler("/static/**").addResourceLocations("/WEB-INF/static/");
}

その後、長いパスを持ついくつかの静的ファイル (/a/b/c/d.cssまたは など/a/b/c/d.js) は静的コンテンツとして機能しましたが、一部のファイル ( など/a/b/c.js) はそうではありません。

私の場合、 RepositoryRestHandlerMappingCSSOrdered.HIGHEST_PRECEDENCEおよび JavaScript リクエストのほとんどは、[/{repository}/{id}/{property}].

これは Spring-Data のバグであり、修正されました (Oliver Gierke のおかげです)。修正されたバージョン 2.0.0.BUILD-SNAPSHOT をスナップショット リポジトリから取得できます。これが役立つことを願っています。

于 2013-07-05T06:37:48.017 に答える