Exception in thread "Thread-13" com.alibaba.fastjson.JSONException: default constructor not found. class com.nowcoder.async.EventModel
at com.alibaba.fastjson.util.JavaBeanInfo.build(JavaBeanInfo.java:212)
at com.alibaba.fastjson.parser.ParserConfig.createJavaBeanDeserializer(ParserConfig.java:504)
at com.alibaba.fastjson.parser.ParserConfig.getDeserializer(ParserConfig.java:451)
at com.alibaba.fastjson.parser.ParserConfig.getDeserializer(ParserConfig.java:306)
at com.alibaba.fastjson.parser.DefaultJSONParser.parseObject(DefaultJSONParser.java:611)
at com.alibaba.fastjson.JSON.parseObject(JSON.java:327)
at com.alibaba.fastjson.JSON.parseObject(JSON.java:231)
at com.alibaba.fastjson.JSON.parseObject(JSON.java:444)
at com.nowcoder.async.EventConsumer.lambda$afterPropertiesSet$0(EventConsumer.java:72)
at java.lang.Thread.run(Thread.java:745)
在指定类添加默认构造函数即可
这是因为spring底层都是通过反射机制,必须有默认构造器来创建对象,设置好属性