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


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

打好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}

 重启程序应该就可以了


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM