美文网首页
spring boot 添加静态资源映射

spring boot 添加静态资源映射

作者: 金刚_30bf | 来源:发表于2018-10-26 14:22 被阅读0次
    @Configuration
    //@EnableMongoRepositories
    public class WeaselWebMVCConfig  implements WebMvcConfigurer{
    
        @Value("${convert_pdfroot}")
        private String convert_pdfroot;
        
        @Bean
        public LogInterceptor getLogInterceptor() {
            return new LogInterceptor();
        }
        
        @Override
        public void addInterceptors(InterceptorRegistry registry) {
            registry.addInterceptor(getLogInterceptor());
            WebMvcConfigurer.super.addInterceptors(registry);
        }
        
        @Override
        public void addResourceHandlers(ResourceHandlerRegistry registry) {
    
            // registry.addResourceHandler("/upload/**").addResourceLocations("file:D:/wekuku_root/upload/"
            // ); //+ uploadProperties.getPath());
            registry.addResourceHandler("/viewroot/**")
                    .addResourceLocations("file:" + convert_pdfroot + "/");
    
        }
    

    相关文章

      网友评论

          本文标题:spring boot 添加静态资源映射

          本文链接:https://www.haomeiwen.com/subject/hegktqtx.html