springboot访问静态资源404
<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/"};
---------------------------------------------------------------------------
国之殇,未敢忘!
南京大屠杀!
731部队!
以及核污染水排海等一系列全无人性的操作,购买他们的食品和为它们提供帮助只会更加变本加厉的害你,呼吁大家不要购买日本相关产品
昭昭前事,惕惕后人
吾辈当自强,方使国不受他人之侮!
---------------------------------------------------------------------------
作者:三号小玩家
出处:https://www.cnblogs.com/q1359720840/
版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。 版权信息