TaleLin / lin-cms-spring-boot

🔨 基于SpringBoot的CMS/DMS/管理系统开发框架

Home Page:http://doc.cms.talelin.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DTO验证只有一个字段的时候有bug

nine-city opened this issue · comments

拉取的Lin CMS最新代码。
代码如下
@PostMapping("/qq/login") public String appLogin(@Validated @RequestBody QQLoginDTO loginDTO) { return "aaa"; }

`
@DaTa
@NoArgsConstructor
public class QQLoginDTO {

@NotBlank(message = "{code.not-blank}")
private String code;

}
`

如果code参数没传,返回给前端没有任何提示信息
{ "code": 10030, "message": "", "request": "POST /user/qq/login" }

报错信息
org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot construct instance of io.github.talelin.latticy.dto.user.AppLoginDTO (although at least one Creator exists): cannot deserialize from Object value (no delegate- or property-based Creator); nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of io.github.talelin.latticy.dto.user.AppLoginDTO (although at least one Creator exists): cannot deserialize from Object value (no delegate- or property-based Creator)

好像是因为只有一个参数检验的时候不能正常序列化
有什么优雅的办法解决这个问题吗