SpringBoot-(10)配置虚拟路径-指定外部路径文件夹存取文件
参考:https://blog.csdn.net/feng2147685/article/details/95623135
package com.online.director; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; /** * Created by zhang_guang_yang on 2019/11/1. */ @Configuration public class OnlineDirectorWebAppConfigurer extends WebMvcConfigurerAdapter { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/server/**").addResourceLocations("file:/Users/zhang_guang_yang/Python/server/"); super.addResourceHandlers(registry); } }