如何配置springboot一访问服务器本地图片

大家好,之前写过一篇配置tomcat访问服务器本地资源的,但现在使用了springboot内嵌tomcatjeyyt后,怎么来访问本地资源呢?

打好springboot框架后,在application.properties文件里配置几项东西:

##添加本地资源,必须以/结尾,访问http://ip:port/webname/11.jpg
web.upload-path=C:/FounderTemp/boc_cbs/
spring.mvc.static-path-pattern=/**
spring.resources.static-locations=classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/,file:${web.upload-path}
classpath:/static/,classpath:/public/,file:${web.upload-path}

 重启程序应该就可以了

原文地址:https://www.cnblogs.com/lingbing/p/7988376.html