所有/webjars/** 都去 classpath:/META-INF/resources/webjars/ 找资源
@Override public void addResourceHandlers(ResourceHandlerRegistry registry) { if (!this.resourceProperties.isAddMappings()) { logger.debug("Default resource handling disabled"); return; } Duration cachePeriod = this.resourceProperties.getCache().getPeriod(); CacheControl cacheControl = this.resourceProperties.getCache().getCachecontrol().toHttpCacheControl(); if (!registry.hasMappingForPattern("/webjars/**")) { customizeResourceHandlerRegistration(registry.addResourceHandler("/webjars/**") .addResourceLocations("classpath:/META-INF/resources/webjars/") .setCachePeriod(getSeconds(cachePeriod)).setCacheControl(cacheControl)); } String staticPathPattern = this.mvcProperties.getStaticPathPattern(); if (!registry.hasMappingForPattern(staticPathPattern)) { customizeResourceHandlerRegistration(registry.addResourceHandler(staticPathPattern) .addResourceLocations(getResourceLocations(this.resourceProperties.getStaticLocations())) .setCachePeriod(getSeconds(cachePeriod)).setCacheControl(cacheControl)); } }/**访问当前项目的任何资源,
静态资源文件夹下的所有index.html页面,被 /** 映射: 在public下添加index.html页面,测试:
https://www.webjars.org/
更改SpringBoot页面的icon:
在2.x以前的版本。直接将你需要的favicon.ico文件倒挡static下面就可以。 2.X以后的版本,取消了自动配置,需要人手动去在每一个页面添加???为啥写favicon.ico都不行的,非要改名加个1啥的才可以?