如何避免Joda对象中的内容字段? [英] How do I avoid content fields in Joda objects?

查看:97
本文介绍了如何避免Joda对象中的内容字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在文档中使用Joda对象(DateTime和DateTimeZone),每当我通过REST接口访问它时,我都会得到包含这样字段的条目

I'm using Joda objects (DateTime and DateTimeZone) in a document and whenever I access it via the REST interface I get entries with fields like this

lastAggregationDate:{content:2016-07-12T17:58:43.643Z}

而不是

lastAggregationDate:2016-07-12T17:58:43.643Z

我宣布了Joda Jackson依赖项,我看到这些类型的de / serializers,所以我很困惑这里有什么工作。

I have the Joda Jackson dependencies declared and I see the de/serializers for these types so I'm puzzled as to what's at work here.

我在略微修改了Spring示例项目,但使用的是Java的本机日期类型而不是Joda的。我已经将一个出生日期属性添加到Person对象并修改了 shouldRetrieveEntity 测试以查找 $ .dateOfBirth.content 。我已经确认正在使用序列化程序,似乎 LocalDate 对象被视为资源而不是简单属性。

I've duplicated this behavior in a slightly modified Spring sample project but using Java's native date types rather than Joda's. I've added a date of birth property to the Person object and modified the shouldRetrieveEntity test to look for $.dateOfBirth.content. I've confirmed the serializer is being used and it seems like the LocalDate object is being treated as a resource rather than as a simple property.

推荐答案

这在Spring Data Hopper-SR4中得到修复:
https://jira.spring.io/browse/DATAMONGO-1498

This is fixed in Spring Data Hopper-SR4: https://jira.spring.io/browse/DATAMONGO-1498

这篇关于如何避免Joda对象中的内容字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆