我希望有人能提供帮助,因为我真的不知道如何解决以下问题:我想使用 Spring Data Redisin序列化Entity和ThumbnailUrlEntity(见下面的代码)的一些对象CrudRepository。由于类有会员我不想连载,我试图通过任何注释类本身有忽略它们以各种方式@JsonIgnoreProperties或通过与标注各部件/性能@JsonIgnore或Filters在RedisConfig.java用CustomConversion。
现在的问题是,无论我尝试哪种忽略方式,org.springframework.data.keyvalue.core.UncategorizedKeyValueException: Path to property must not be null or empty.; nested exception is java.lang.IllegalArgumentException: Path to property must not be null or empty.当我尝试保存相应的对象时,总是会遇到相同的错误。(有关更多详细信息,请参阅下面的 Stacktrace)
我什至在这些课程中使用 MixIn 尝试过,但效果不佳......
所以问题是:如何在使用 Spring-Data-Redis 序列化某个类的对象时正确忽略属性?
实体.java
@EqualsAndHashCode(exclude = "domainObject")
@ToString(exclude = "domainObject")
@NoArgsConstructor
//@JsonIgnoreProperties("domainObject")
@JsonFilter("myEntityFilter")
public abstract class Entity<T extends DomainObject> {
@TimeToLive
protected final static long TIME_TO_LIVE = 60 * 60 * 24;
@Id
@Indexed
private String id;
// @Transient
// @JsonIgnore
private T domainObject;
public Entity(@NotNull T domainObject) {
this.domainObject = domainObject;
}
public abstract Entity<T> createFromDomainObject(@NotNull T domainObject);
public abstract void updateFromDomainObject(T domainObject);
public void updateFromDomainObject() {
this.updateFromDomainObject(this.getDomainObject());
}
public String getId() {
return id;
}
// @Transient
// @JsonIgnore
public T getDomainObject() {
return domainObject;
}
public void setDomainObject(T domainObject) {
this.domainObject = domainObject;
}
}
桃花长相依
相关分类