SpringBoot 配置图片虚拟路径

// 配置图片虚拟路径
        try {
File file = new File(gunsProperties.getFileUploadPath());
String url = file.toURI().toURL().toString();
registry.addResourceHandler("/image/**").addResourceLocations(url); 
logger.info("图片虚拟路径配置成功:{}",url);
        } catch (MalformedURLException e) {
logger.error("图片虚拟路径配置失败:{}", e.getMessage());

}

详情看示例

你可能感兴趣的:(工作笔记,Spring,Boot)