springboot图片预览
时间: 2023-10-12 10:05:28 浏览: 120
在Spring Boot中实现图片预览可以通过配置静态资源的映射路径来实现。首先,在项目中创建一个配置类,例如`WebAppConfigurer`,并且让它实现`WebMvcConfigurer`接口。然后,在`addResourceHandlers`方法中,配置资源的虚拟路径和本地路径。比如,如果你想要访问`/upload/avatar/aaa.png`这个路径,程序会在`E:\\upload\\avatar\\`目录下查找`aaa.png`文件。最后,你可以使用这个地址在浏览器上进行图片预览。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [SpringBoot上传图片到本地并在线预览](https://blog.csdn.net/LoveYMG/article/details/126599988)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* [java课程设计项目:基于SpringBoot的在线订餐系统.zip](https://download.csdn.net/download/qq_35831906/88222416)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文