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