#application.yml配置文件新增如下配置
spring:
mvc:
static-path-pattern: /**
resources:
static-locations: classpath:/static,file:/root/webproject/dist #windows系统下绝对路径:file:E:/static/
@Controller public class DefaultController { @RequestMapping(value ="/",method = RequestMethod.GET) public String home() { //会到配置的静态资源目录搜索下面文件返回 return "/index.html"; } }
原文:https://www.cnblogs.com/jvStarBlog/p/12712180.html