fastjson 死循环

ppcbkaq5  于 2021-11-27  发布在  Java
关注(0)|答案(1)|浏览(322)
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();
    }
}

相关问题