SpringBoot--实用配置汇总
静态资源目录配置(前段打好的包可以放在该目录下,从而实现前后端整合)
#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"; } }
项目结构:

 
                    
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号