springboot 使用(@RequestBody CancelParamsVo cancelParamsVo )接受参数,参数开头大写接受不到数据
解决
加入一下注解@JsonProperty("POOrderNumber")
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* 商品订单号
*/
@JsonProperty("POOrderNumber")
private String POOrderNumber;
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.5.3</version>
</dependency>
在SpringBoot中遇到使用@RequestBody无法接收首字母大写的JSON参数问题,通过添加@JsonProperty注解并指定字段名解决了该问题。引入Jackson库的jackson-databind依赖,并在实体类中对相应属性添加注解,如`@JsonProperty(POOrderNumber) private String POOrderNumber`,确保能正确映射JSON请求中的字段。
343

被折叠的 条评论
为什么被折叠?



