美文网首页
springcloud使用feign下载

springcloud使用feign下载

作者: ydd7z | 来源:发表于2019-06-25 11:37 被阅读0次

    springcloud版本Finchley.RELEASE
    springboot版本2.0.8.RELEASE

    public interface DownloadService {
        @RequestLine("GET")
        Response downloadPdf(URI uri);
        
        @Component
        @Import(FeignClientsConfiguration.class)
        class DownloadServiceImpl implements DownloadService {
            private DownloadService downloadService;
            
            @Autowired
            public DownloadServiceImpl(Decoder decoder, Encoder encoder) {
                downloadService = Feign.builder()
                        .encoder(encoder).decoder(decoder).target(Target.EmptyTarget.create(DownloadService.class));
            }
            
            @Override
            public Response downloadPdf(URI uri) {
                return downloadService.downloadPdf(uri);
            }
            
        }
    
    }
    
    

    相关文章

      网友评论

          本文标题:springcloud使用feign下载

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