【问题标题】:How to configure spring boot for using klaxon library如何配置 Spring Boot 以使用 klaxon 库
【发布时间】:2018-07-09 05:03:23
【问题描述】:

有一个klaxon library - kotlin 的 JSON 解析器

如何配置Spring Boot以使用它以这种方式制作REST API:

@RestController
class SampleController {

  @RequestMapping("/test", method = [RequestMethod.POST])
  fun test(@RequestBody body:JsonObject): JsonObject {
      //work with body val (KLAXON object)
      //return KLAXON object
  }
}

@RequestBody body:JsonObject - 是一个 Klaxon 对象,所以我们不想为 RequestBody 使用标准的Jackson2ObjectMapperBuilder。为简单起见,我们也不想将它用于响应正文。 帖子正文是某种动态数据,所以我想在 lib 中使用Low level API,而不是Object binding API

【问题讨论】:

    标签: json spring-boot kotlin spring-restcontroller klaxon


    【解决方案1】:

    不,目前不可能。

    Reference

    【讨论】:

      猜你喜欢
      • 2018-08-07
      • 1970-01-01
      • 2018-06-14
      • 2014-10-04
      • 2016-07-04
      • 2017-11-14
      • 1970-01-01
      • 1970-01-01
      • 2016-05-15
      相关资源
      最近更新 更多