<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

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

springboot访问静态资源404

 

 

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


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

springboot访问静态资源404

 

 获取我们得资源路径

springboot访问静态资源404

 

 springboot得静态资源路径配置

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








相关文章:

  • 2021-11-18
  • 2021-11-20
  • 2021-11-20
  • 2021-11-20
  • 2021-11-20
  • 2021-11-20
  • 2021-11-15
猜你喜欢
  • 2022-02-24
  • 2021-11-20
  • 2021-05-02
  • 2021-10-06
相关资源
相似解决方案