首页 > 编程语言 > 详细

springboot访问静态资源404

时间:2021-07-13 14:57:46      阅读:13      评论:0      收藏:0      [点我收藏+]
<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/"};








springboot访问静态资源404

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!