After upgrading to latest versions, with hibernate-validator(as part of spring-boot-starter-validation dependency) there are a few validations in place. I am getting this error :
jakarta.validation.ConstraintDeclarationException: HV000151: A method overriding another method must not redefine the parameter constraint configuration, but method Controller#method(List, String) redefines the configuration of Controller#method(List, String).
This occurs when you are implementing an interface method and redefine the parameter constraints in the implementation. The problem is, when I remove the parameter constraints from the implementation, the parameter validation is not taking place when ideally it should inherit those constraints from the interface.
Interface:
`ResponseEntity<object> method(@ApiParam(value = "Request Body",required = true) @RequestBody @Valid List<object1> request, @ApiParam("language of the (Exception Detail) response ") @RequestParam(value = "lang",required = false) @Valid String lang);`
Implementation(after removing parameter constraints):
@Override public ResponseEntity<object> method( List<object1> request, String lang) { return new ResponseEntity<>(handler.method2(request, lang), httpHeaders, HttpStatus.CREATED); }
Use
@Validin signature of interface will solve this problem.