html文件放在resources/templates下,在请求处理方法返回时会自动到这个目录下查找
js/css等静态资源放在resources/static下,在html中引入时,会自动到这个目录下查找
如图:
<script type="text/javascript" src="./jquery-3.2.1/jquery.js"/>
若要改变资源访问路径,可以修改以下参数:
spring:
mvc:
static-path-pattern: /**
resources:
static-locations: file:/www/wwwroot/static/
上面那个参数用来设置匹配访问请求,下面是设置资源绝对物理路径