mybatis 嵌套查询,所报异常加上 @JsonIgnoreProperties(value = { "hibernateLazyInitializer", "handler" })注解
@Getter
@Setter
@NoArgsConstructor
@JsonIgnoreProperties(value = { "hibernateLazyInitializer", "handler" })
public class PlatRoleVO {
private String platId;
private String title;
private boolean expand;
private List<Role> roles;
@Getter
@Setter
@NoArgsConstructor
private static class Role {
private String roleId;
private String title;
}
public boolean isExpand() {
return expand;
}
public void setExpand(boolean expand) {
if (this.roles != null && this.roles.size() > 0) {
this.expand = true;
}
}
}
Could not write JSON: No serializer found for class org.apache.ibatis.executor.loader.javassist.JavassistProxyFactory$EnhancedResultObjectProxyImpl and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS); nested exception is com.fasterxml.jackson.databind.JsonMappingException: No serializer found for class org.apache.ibatis.executor.loader.javassist.JavassistProxyFactory$EnhancedResultObjectProxyImpl and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: com.linlong.back.core.model.ResponseModel["content"]->java.util.ArrayList[0]->com.linlong.back.auth.plat.mapper.custom.entity.PlatRoleVO_$$_jvst87c_0["handler"])