我正在使用Spring REST(3.2.8.RELEASE),GAE和Objectify(v 4.0b3)开发Web应用程序。我对GAE和Objectify都是新手。Jackson JSON不会忽略Objectify Key
应用程序以JSON格式返回数据。
Jackson在序列化Objectify Key时遇到500错误。所以,我试图使用本文中提到的@JsonIgnore JsonMappingException: How to transfert a Objectify Entity (with Key) through Restlet。 但它仍然抛出相同的500错误。我试图将@JsonIgnore放在属性,getter,setter方法中,但没有运气。
有人可以给我一些关于我可能做错的指导吗?另一种选择是编写自定义序列化程序。
非常感谢您的帮助。
public class CategoryTrackingCount {
Key<CategoryTracking> categoryTrackingKey;
@JsonIgnore
public Key<CategoryTracking> getCategoryTrackingKey() {
return categoryTrackingKey;
}
@JsonIgnore
public void setCategoryTrackingKey(Key<CategoryTracking> categoryTrackingKey) {
this.categoryTrackingKey = categoryTrackingKey;
}
}
显然,org.codehaus.jackson和com.fasterxml.jackson位于pom.xml中。我删除了org.codehaus.jackson,它工作。 – user1775967