springboot配置静态资源位置static-locations、静态资源路径前缀static-path-pattern
springboot配置静态资源位置static-locations、静态资源路径前缀static-path-pattern
·
spring:
web:
#springboot_v2.4以后配置方式。springboot_v2.3以前不需要“web”
resources:
#静态资源位置。默认为 "classpath:/META-INF/resources/","classpath:/resources/", "classpath:/static/", "classpath:/public/"
static-locations:
- file:./dist/ # 相对路径。命令行所在的目录
#- file:D:/workspace/lishuoboy-test/dist/
mvc:
#静态资源访问路径前缀。默认为根目录/**,如http://localhost:8080/stat/贾静雯.png。如需配置多个,实现 WebMvcConfigurer.addResourceHandlers()
#static-path-pattern: /**
static-path-pattern: /stat/**

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐
所有评论(0)