最近有需求是点击下载按钮后下载指定url的pdf文件到本地 下面通过SpringBoot来实现一下: 思路就是: 解析url,建立连接获取输入流 copy输入流到输出流中,进行相关设置并返回 @GetMapping("/download") public void download(@RequestParam("url") String urlStr, HttpServletResponse response) throws IOEx