SpringBoot 使用@RequestBody 接受不到参数的问题

首先看问题:

postman

实体:

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Test{
    private Long id;
    private Integer ifCertification;
}

 发现ifCertification使用@RequestBody 总是接受不到参数;

 解决方式:

@JsonProperty(value = "xxx") (原因: 因为实体类参数和 传入的参数不一致,驼峰命名,等问题。增加上这个注解映射后,及可获取实体类中的参数值)

(完) 

猜你喜欢

转载自blog.csdn.net/qq_36850813/article/details/94628232