The background of springboot message passing parameters cannot be parsed (single-letter camel case naming)

        Currently using springboot version 2.4.1, it is found that the background of the message transmission parameters cannot be received, the code is as follows:
 

@PostMapping (consumes = MediaType.APPLICATION_JSON_VALUE)
public Result <Integer> insert (@Validated @RequestBody ConfigInsertDto configInsertDto){
    ……
}
{
  "cName": "登录会话",
  "cKey": "session",
  "cValue": "JSESSIONID=578228A3F7018610B36B86EA9C031CFC",
  "vSts": "Y",
  "cDesc": "登录会话",
}

        The backend prompt parameter cannot be empty. It is found that the RequestBody annotation has been written, and the attribute name of the parameter dto is also corresponding. Suddenly it feels like there is a problem with the parameter encapsulation. The unit test using Alibaba's fastjson framework was successfully parsed into an entity class. Due to the particularity of the attribute, a single letter begins with a lowercase hump, which is suspected to be the cause.

There are two solutions to the cause of the problem:

  1. Change springboot's default json parsing tool from jackson to fastjson;
  2. Change variable initials to multi-letter

Reference: (6 messages) Possible problems encountered in jackson single-letter hump naming_Esby's Daily Blog-CSDN Blog_jackson hump naming

Guess you like

Origin blog.csdn.net/u011471105/article/details/124725423