zoukankan      html  css  js  c++  java
  • Spring Batch JSON 支持

    Spring Batch 4.1 开始能够支持 JSON 格式了。这个发布介绍了一个新的数据读(item reader)能够读取一个 JSON 资源,这个资源按照下面的格式:

    [
      {
        "isin": "123",
        "quantity": 1,
        "price": 1.2,
        "customer": "foo"
      },
      {
        "isin": "456",
        "quantity": 2,
        "price": 1.4,
        "customer": "bar"
      }
    ]

    与针对 XML 的 StaxEventItemReader 类似,新的 JsonItemReader 使用流 API(streaming APIs)来读取 JSON 对象到块中。Spring Batch 能够支持下面 2 个库:

    如果你还希望添加其他的库的话,你可以实现 JsonObjectReader  接口。

    JSON 数据的写是通过 JsonFileItemWriter 来支持的。

    有关更多 JSON 数据的支持,请参考 ItemReaders and ItemWriters 章节中的内容。

    https://www.cwiki.us/display/SpringBatchZH/JSON+support

  • 相关阅读:
    平时十二测
    无题十四
    暑假第十测
    无题十三
    noip错题集
    无题十二
    BZOJ整理
    志愿者招募
    修车
    任务安排
  • 原文地址:https://www.cnblogs.com/huyuchengus/p/10291372.html
Copyright © 2011-2022 走看看