<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Spring on 村边的池塘</title>
    <link>https://jerrywang1981.github.io/tags/spring/</link>
    <description>Recent content in Spring on 村边的池塘</description>
    <generator>Hugo</generator>
    <language>zh-CN</language>
    <lastBuildDate>Fri, 11 Sep 2020 15:55:30 +0800</lastBuildDate>
    <atom:link href="https://jerrywang1981.github.io/tags/spring/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>添加第三方jar到Spring Boot application</title>
      <link>https://jerrywang1981.github.io/post/java/add-third-party-jar-to-spring-boot/</link>
      <pubDate>Fri, 11 Sep 2020 15:55:30 +0800</pubDate>
      <guid>https://jerrywang1981.github.io/post/java/add-third-party-jar-to-spring-boot/</guid>
      <description>背景 有时候需要添加第三方的jar包到spring boot工程中，因为不能从maven repository直接下载，所以需要包含在代码库中。 一般需要在 src/main 目录下，可以建个新目录 lib, 然后把jar文件放到这个目录下，也就是 src/main/lib下. 然后在pom.xml中需要添加 group</description>
    </item>
    <item>
      <title>Vue File Download From Spring Boot</title>
      <link>https://jerrywang1981.github.io/post/vue/file-download-from-spring-boot/</link>
      <pubDate>Thu, 10 Sep 2020 07:52:49 +0800</pubDate>
      <guid>https://jerrywang1981.github.io/post/vue/file-download-from-spring-boot/</guid>
      <description>File download 如果spring boot的写法是我在另外一个文章, 返回的response其实是一个Blob, 这一点要记住 this.axios.get(url, { responseType: &amp;#39;blob&amp;#39;, timeout: 0 }).then(response =&amp;gt; { // response is Blob &amp;lt;------- const url = window.URL.createObjectURL(response) const a = document.createElement(&amp;#39;a&amp;#39;) a.style.display = &amp;#39;none&amp;#39; a.href = url a.setAttribute(&amp;#39;download&amp;#39;,&amp;#39;file.xlsx&amp;#39;) document.body.appendChild(a) a.click() document.body.removeChild(a); window.URL.revokeObjectURL(url); });</description>
    </item>
    <item>
      <title>Spring Boot File Download</title>
      <link>https://jerrywang1981.github.io/post/java/spring-boot-file-download/</link>
      <pubDate>Thu, 10 Sep 2020 07:52:13 +0800</pubDate>
      <guid>https://jerrywang1981.github.io/post/java/spring-boot-file-download/</guid>
      <description>spring boot application 提供下载的代码，可以返回一个Resource @RestController @RequiredArgsConstructor @RequestMapping(&amp;#34;/api&amp;#34;) public class ReportController { @GetMapping(value = &amp;#34;/filedownload&amp;#34;) public ResponseEntity&amp;lt;InputStreamResource&amp;gt; downloadFile(HttpServletRequest request) { // ....................... // ....................... // ....................... ByteArrayInputStream stream = xxxxxx;// get the stream return ResponseEntity.ok().contentType(MediaType.APPLICATION_OCTET_STREAM) .header(HttpHeaders.CONTENT_DISPOSITION, &amp;#34;attachment; filename=file.xlsx&amp;#34;) .body(new InputStreamResource(stream)); } }</description>
    </item>
  </channel>
</rss>
