合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
spring boot的默认静态内容在目录`/static` (或`/public` or `/resources `or `/META-INF/resources`)或`ServletContext`根目录.使用mvc的`ResourceHttpRequestHandler`,可以自定义,添加`WebMvcConfigurer`重写`addResourceHandlers `方法. 默认资源映射到url是`/**`(不是`/static/**`,这是目录,不是url),你可以使用`spring.mvc.static-path-pattern`来修改.如 ~~~ spring.mvc.static-path-pattern=/resources/** ~~~ 你也可以使用`spring.resources.static-locations`指定静态资源目录 >如果应用要打包jar,不要使用包`src/main/webapp`.这个包只有在打成war包才能正常