静态资源目录配置(前段打好的包可以放在该目录下,从而实现前后端整合)

#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";
    }
}    

 项目结构:

SpringBoot--实用配置汇总

 

相关文章:

  • 2022-02-20
  • 2022-01-28
  • 2021-04-05
  • 2022-02-02
  • 2021-08-09
  • 2021-05-23
  • 2021-10-10
  • 2021-07-19
猜你喜欢
  • 2022-01-05
  • 2021-11-13
  • 2022-12-23
  • 2022-01-14
  • 2022-02-02
  • 2022-12-23
  • 2021-11-19
相关资源
相似解决方案