問題
放在resources/static下的靜態(tài)css、js文件無法訪問,報404錯誤
解決方法:
在application.properties文件中,增加
# 靜態(tài)路徑pattern
spring.mvc.static-path-pattern=/**
然后就可以在templates/index.html文件中按以下方式訪問了
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap-theme.min.css">
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="/js/bootstrap.min.js"></script>