springboot访问静态资源404

时间:2021-07-13 14:57:46   收藏:0   阅读:14
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

当时引入了模板引擎 static中得静态资源说啥都访问不到,后来加入了配置就好了

技术分享图片

 

 

spring:
mvc:
static-path-pattern: /static/**
resources:
static-locations: classpath:/static


WebMvcAutoConfiguration中
这个是设置得请求方式,put,delete,get啥的

技术分享图片

 

 获取我们得资源路径

技术分享图片

 

 springboot得静态资源路径配置

ResourceProperties这个类
private static final String[] CLASSPATH_RESOURCE_LOCATIONS = new String[]{"classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/"};








原文:https://www.cnblogs.com/q1359720840/p/15005901.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!