1. 问题
今天在启动spring boot项目时,idea报出错误:Error:Kotlin: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.13.,如下图所示:
2. 分析问题
原来是idea的kotlin插件版本比pom中的低。
对此,可以有以下两种思路:
当把如下一个类利用fastjson转成json串时
public class Model{
private Integer id;
}
Model model = new Model();
model.id = 1001;
String json = JSON.toJSONString(model);
json 结果为{}; 这是因为把id设置为了private变量json解析时无法获取到id。有两种方式
方式1:把id设置为public
方式2:添加对应字段的set*