跳至主要內容
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?

4563博客

全新的繁體中文 WordPress 網站
  • 首頁
  • Java – 使用 @RequestExcel 和 @ResponseExcel 注解轻松上传和下载 Excel 文件
未分類
22 11 月 2020

Java – 使用 @RequestExcel 和 @ResponseExcel 注解轻松上传和下载 Excel 文件

Java – 使用 @RequestExcel 和 @ResponseExcel 注解轻松上传和下载 Excel 文件

資深大佬 : gaobing 3

做成了 Spring Boot Starter 的形式,方便引入使用。

下载示例,类似于 @ResponseBody :

@RequestMapping("/download") @ResponseExcel({"name", "book.name", "book.author"}) public List<Character> download() {     return listCharacters(); } 

上传示例,类似于 @RequestParam :

@RequestMapping("/upload") @ResponseBody public List<Character> upload(@RequestExcel(value = "excel", targetClass = Character.class,                                        fieldNames = {"name", "book.name", "book.author"})                            List<Character> characters) {     return characters; } 

已提交至 Maven 中央仓库。

<dependency>     <groupId>com.gaoice</groupId>     <artifactId>easyexcel-spring-boot-starter</artifactId>     <version>2.0</version> </dependency> 

欢迎使用和 Star ^_^

GitHub: https://github.com/gaoice/easyexcel-spring-boot-starter

大佬有話說 (6)

  • 資深大佬 : ychost

    赞!!

  • 資深大佬 : fd7917931e

    这个不错!

  • 資深大佬 : shuige

    2.0 哪里下载?

  • 資深大佬 : zsl199512101234

    赞,一开始以为啥 Alibaba 的那个 easyexcel 呢

  • 資深大佬 : 2han9wen71an

    请问只能在 spring 上用吗?我们平常使用的 resteasy 加 guice 来开发能使用吗?

  • 主 資深大佬 : gaobing

    @shuige 现在中央仓库应该可以了,[https://search.maven.org/artifact/com.gaoice/easyexcel-spring-boot-starter/2.0/jar]( https://search.maven.org/artifact/com.gaoice/easyexcel-spring-boot-starter/2.0/jar) ,其它仓库等同步过去才可以

    @2han9wen71an 注解是只能在 Spring 中使用。工具类可以在其它框架使用:[https://github.com/gaoice/easyexcel]( https://github.com/gaoice/easyexcel)

文章導覽

上一篇文章
下一篇文章

AD

其他操作

  • 登入
  • 訂閱網站內容的資訊提供
  • 訂閱留言的資訊提供
  • WordPress.org 台灣繁體中文

51la

4563博客

全新的繁體中文 WordPress 網站
返回頂端
本站採用 WordPress 建置 | 佈景主題採用 GretaThemes 所設計的 Memory
4563博客
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?
在這裡新增小工具