springboot1配置虚拟路径

无敌的宇宙
无敌的宇宙
擅长邻域:Java,HTML,JavaScript,MySQL,支付,退款,图片上传

分类: Java springboot 专栏: java springboot 标签: springboot1配置虚拟路径

2022-12-16 22:47:37 318浏览

springboot1配置虚拟路径

 --------------------

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class MyWebMvcConfigurerAdapter extends WebMvcConfigurerAdapter {
 
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {      
        //registry.addResourceHandler("/upimgs/**").addResourceLocations("file:F:/upimgs/");
        registry.addResourceHandler("/upimgs/**").addResourceLocations("file:/usr/myspringboot/renthouse/upimgs/");
    }
}
 

好博客就要一起分享哦!分享海报

此处可发布评论

评论(0展开评论

暂无评论,快来写一下吧

展开评论

您可能感兴趣的博客

客服QQ 1913284695