1、注释的作用@JSONfield(serialize=false )注释可以去除返回响应参数主体时存在的字段
例如:
//返回时取消密码字段@ JSON field (串行=假) private String password; 2、从SpringBoot出现的问题 视图中查看当前获取的json字符串,带有@JSONfield(serialize=false )注释的字段也被序列化
默认情况下,3358 www.Sina.com/http://www.Sina.com/sprint boot通过dmdws转换JSON。 @JSONfield(Serialize=false )是FastJson的评论,sppon
4、解决方案添加到Springboot启动类中
@ beanpublichttpmessageconvertersfastjsonhttpmessageconverters ({ fastjsonhttpmessageconverterfastconverter=newfastjsonhteter fastjsonconfig.setserializerfeatures (串行化器feature.pretty格式); fast converter.setfastjsonconfig (fastjsonconfig ); HttpMessageConverter? 转换器=快速转换器; returnnewhttpmessageconverters (converter ); }