alibaba / fastjson

FASTJSON 2.0.x has been released, faster and more secure, recommend you upgrade.
https://github.com/alibaba/fastjson2/wiki/fastjson_1_upgrade_cn
Apache License 2.0
25.74k stars 6.5k forks source link

如何在get方法请求接收的bean中,使得JSONField注解生效 #3617

Open lrbmike opened 3 years ago

lrbmike commented 3 years ago

最近整合了springboot和fastjson,在前端通过post的方式提交json格式的数据,后端使用@RequestBody 注解的bean可以正常通过 @JSONField 注解转换。 但是最近遇到一个情况,就是对于get请求中,如果想通过bean接收时,发现bean的字段JSONField 注解并不生效,但是get参数的同名字段可以正常注入值。 想问一下是否有相关配置可以处理这种情况?对于FastJsonHttpMessageConverter,是不是只会对json格式的数据进行处理。

LSL1618 commented 3 years ago

@RequestBody不适用于get请求