为啥springboot只能访问一级静态资源呢?

static下的图片可以访问到,img文件夹里的访问不到,这是为啥呢?

看一下拦截器配置,是不是给拦截了

<!-- 静态资源文件,不会被Spring MVC拦截 -->
<mvc:resources location="/resources/" mapping="/resources/**"/>

看错了,springboot....

在static下创建img,css,js。。。等文件夹

问题已经解决了,在application.properties里面加上这个就好了
spring.resources.static-locations=classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/
但是这个就是springboot的默认设置,不知道问什么还要重新声明。

其实我刚开始就用了这个方法,但是不知道为什么
资源下载这个方法没有生效。

怎么会呢。   你在application.properties设置它:spring.datasource.druid.stat-view-servlet.url-pattern=/static/*   应该是全部都能扫到的哈。

application.properties:
spring.resources.static-locations=classpath:/static
引用:
<script type="text/javascript" src="/js/wijmo.chart.min.js"></script>

 

 

 

相关文章:

  • 2021-11-15
  • 2021-08-01
  • 2021-12-24
  • 2021-12-02
  • 2021-12-23
猜你喜欢
  • 2021-09-28
  • 2021-11-20
  • 2021-11-20
  • 2021-11-20
  • 2021-11-20
  • 2021-11-20
相关资源
相似解决方案