一、在html加载js文件失败
使用了spring security,会对我们的静态文件进行拦截,所以需要配置下,如下:
二、前台发送 ajax请求 /addUser接口时,返回403错误,原因是security拦截了POST请求(GET不会拦截)。
我在HTML页面增加了如下信息:
JS文件我增加了如下信息:
另外,再贴下相关配件文件
spring.mvc.static-path-pattern=/static/**
spring.thymeleaf.enabled=true
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.mode=HTML5
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.servlet.content-type=text/html
spring.thymeleaf.suffix=.html