0
我有春天啓動應用程序(1.4.0.RELEASE)春天啓動不提供靜態的JavaScript文件
我的靜態內容在於/src/main/resources/static/*
下和其中一個頁面需要CSS和JS文件,但儘管一個很奇怪的行爲該CSS文件,但是沒有我的js文件獲得404問題提供了一個事實:
對於CSS文件,我在日誌中
SimpleUrlHandlerMapping : No handler mapping found for [/admin_files/custom_admin.css]
RequestMappingHandlerMapping : Looking up handler method for path /admin_files/custom_admin.css
RequestMappingHandlerMapping : Did not find handler method for [/admin_files/custom_admin.css]
SimpleUrlHandlerMapping: Matching patterns for request [/admin_files/custom_admin.css] are [/**]
SimpleUrlHandlerMapping : Mapping [/admin_files/custom_admin.css] to HandlerExecutionChain with handler [ResourceHttpRequestHandler [locations=[ServletContext resource [/], (...)
看到,所以它看起來完全沒問題。然而,對於JS文件,它看起來不同:
SimpleUrlHandlerMapping : No handler mapping found for [/admin_files/vendor/jquery/dist/jquery.min.js]
RequestMappingHandlerMapping : Did not find handler method for [/admin_files/vendor/jquery/dist/jquery.min.js]
SimpleUrlHandlerMapping : Matching patterns for request [/admin_files/vendor/jquery/dist/jquery.min.js] are [/**]
SimpleUrlHandlerMapping : Mapping [/admin_files/vendor/jquery/dist/jquery.min.js] to HandlerExecutionChain with handler [ResourceHttpRequestHandler [locations=[ServletContext resource [/] (...)
//
// and now something strange starts to happen BELOW
//
HttpEntityMethodProcessor : Written [{timestamp=Tue Sep 13 23:17:12 CEST 2016, status=404, error=Not Found, message=No message available, path=/admin_files/vendor/jquery/dist/jquery.min.js}] as "application/json" using [org.springfr[email protected]29139aae]
我真的很堅持,因爲它看起來像一個非常小的故障或我思念的東西的地方非常小。
我的應用程序是這樣的:
@SpringBootApplication
@EnableAsync
@EnableTransactionManagement(proxyTargetClass = true)
@EnableEncryptableProperties
public class Application extends WicketBootSecuredWebApplication { }
沒有任何自定義配置豆類等
tree
在/src/main/resources
執行:
.
├── application-dev.yml
├── application-prod.yml
├── application-staging.yml
├── application.yml
├── banner.txt
└── static
└── admin_files
├── custom_admin.css
└── vendor
├── jquery
│ ├── jquery.js
│ └── jquery.min.js
└── metisMenu
├── metisMenu.css
├── metisMenu.js
├── metisMenu.min.css
└── metisMenu.min.js
任何幫助表示讚賞!
您配置了'mvc'選項還是將其保留爲自動配置? – nurgasemetey
@nurgasemetey在我的yaml文件中沒有'mvc'相關配置。 –
請添加項目/資源樹 – reos