當前位置:
首頁 >
前端技术
> javascript
>内容正文
javascript
Springboot配置拦截器出现“No mapping for GET“静态资源的情况
生活随笔
收集整理的這篇文章主要介紹了
Springboot配置拦截器出现“No mapping for GET“静态资源的情况
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
出現(xiàn)這種情況,假定css,js,fonts文件都在/resources/static下,那么在webConfig.java內加上這兩個函數(shù)
private static final String[] CLASSPATH_RESOURCE_LOCATIONS = {"classpath:/META-INF/resources/", "classpath:/resources/","classpath:/static/", "classpath:/public/" };@Overridepublic void addResourceHandlers(ResourceHandlerRegistry registry) {if (!registry.hasMappingForPattern("/webjars/**")) {registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");}if (!registry.hasMappingForPattern("/**")) {registry.addResourceHandler("/**").addResourceLocations(CLASSPATH_RESOURCE_LOCATIONS);}}這本轉自
另附一篇也可以解決的文章
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的Springboot配置拦截器出现“No mapping for GET“静态资源的情况的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 2021年香水品牌社媒营销分析报告
- 下一篇: 2021年95后“他经济”研究报告