spring boot 整合js css 静态文件

一,添加配置

spring:
  application:
    name: interview-server
  resources:
    static-locations: file:config/statics   //这里修改为指定的路径,它的默认路径为:classpath:[/META-INF/resources/, /resources/, /static/, /public/] 

二,在网页中添加引用

<script type="text/javascript" src="/js/login.js"></script>

三,目录结构


学习交流群:677464431,更多文章:http://www.coc88.com

原文地址:https://www.cnblogs.com/wgslucky/p/9932889.html