springboot+thymeleaf静态资源的访问不到的问题

resources结构截图如下:

1、首先需要在配置文件中加入配置:

spring.resources.static-locations=classpath:/static/

2、在html页面中引用的地方(以引用js文件为例)

<script type="text/javascript" th:src="@{/static/js/jquery-3.3.1.min.js}"></script>

如有错误欢迎批评指正!

发布了11 篇原创文章 · 获赞 1 · 访问量 6823

猜你喜欢

转载自blog.csdn.net/u010808777/article/details/100174471