如何配置 Spring Boot 以使用 klaxon 库

Posted

技术标签:

【中文标题】如何配置 Spring Boot 以使用 klaxon 库【英文标题】:How to configure spring boot for using klaxon library 【发布时间】: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

【问题讨论】:

【参考方案1】:

不,目前不可能。

Reference

【讨论】:

以上是关于如何配置 Spring Boot 以使用 klaxon 库的主要内容,如果未能解决你的问题,请参考以下文章

如何使用 Spring Boot 以编程方式确定当前的活动配置文件 [重复]

如何使用 Spring Boot 以编程方式确定当前的活动配置文件 [重复]

如何配置 IntelliJ HQL 控制台以使用 Spring Boot

如何配置 Spring Boot 以使用两个数据库?

如何在 spring-boot 配置中加载 application.yaml 配置以进行硒测试

如何配置spring-boot千分尺以推入elasticsearch?