public class TJson {
@NoArgsConstructor
@AllArgsConstructor
static class MdlJsonSelft{
private Integer id;
private String name;
public boolean isOk(){
System.out.println("before json ");
// 2 在该方法中调用JSON.toJSONString 产生死循环!!!
System.out.println("json = " + JSON.toJSONString(this));
System.out.println("after json");
return true;
}
}
public static void testJson(){
MdlJsonSelft mdlJsonSelft = new MdlJsonSelft(1, "name");
mdlJsonSelft.isOk();
}
}
1条答案
按热度按时间bq9c1y661#
这个无法避免