How to create a custom validator annotation in Spring Boot?
I would like to validate both the @RequestBody
as well as path parameters. Ideally, I'd like to create my own @CustomValid
annotation instead of the @Valid
one.
In addition to doing checks like @NotNull
on the DTO itself, I want to actually check if say, the id of the object to be updated actually exists in the database. For example for this request:
{
"id": "2348291983918",
"name": "Carol"
}
I'd like to do a lookup for whether the users mongo collection actually contains an object with the id passed in or reject it.
Does anyone know how to do this?
链接地址: http://www.djcxy.com/p/61100.html上一篇: 作为系统帐户运行