Spring Boot thymeleaf 引入js css 报错404 找不到文件问题

Spring Boot thymeleaf 引入js css 报错404 找不到文件问题

在application.properties中加入:

spring.mvc.static-path-pattern=/**

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

html中引入

<script th:src="@{/jquery.js}"></script> 或

<script src="jquery.js"></script> 

jquery.js在当前目录(目录resources/templates/jquery.js , html也在当前目录)

猜你喜欢

转载自xinjiatao.iteye.com/blog/2404595