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);
    }
}

  

posted on 2019-11-02 19:17  洋子哥哥  阅读(717)  评论(0编辑  收藏  举报