Hi Team,

I have successfully extended the ResponseEntityExceptionHandler class to perform validation. It was successfully in SB version 2.2.7.RELEASE. Unfortunately, I am not able to replicate the same successful validation behavior by extending the ResponseEntityExceptionHandler class in SB 2.3.0.RELEASE or 2.3.1.RELEASE. Any guidance around this issue would be very helpful.

Thanks,

-h

Comment From: scottfrederick

Thanks for the report. We'll need more information to be able to provide guidance on what's not working for you. The ResponseEntityExceptionHandler interface is provided by Spring Framework, not by Spring Boot, so it's not clear which project is involved in this issue.

If you would like us to spend some time investigating, please provide more detail on what you mean by "not able to replicate the same successful validation behavior", including any error messages you are getting. A minimal sample that reproduces the problem would be ideal.

Comment From: harjeetp

HI Scott,

Thank you for the prompt response. I have revert to using Spring Boot 2.2.7-Release. Using the Spring Boot 2.2.7-Release, I have implemented a controller class marked with: @RestController. In this class, I validate incoming REST requests using the @Valid stereotype as such:

@PostMapping(path= "/", consumes = "application/json", produces = "application/json")
public ResponseEntity<SearchDomain> fbiSearch(@RequestBody **@Valid** SearchDomain _search)

I am currently relying on a class I have implemented that extends the ResponseEntityExceptionHandler class to perform the validations. I have overridden some of the methods for ResponseEntityExceptionHandler.

@Order(Ordered.HIGHEST_PRECEDENCE)
@ControllerAdvice(basePackages = "***********************")
public class SearchControllerExHandler extends ResponseEntityExceptionHandler
{
public ResponseEntity<Object> handleHttpMessageNotReadable(...)
...
}

The validation checks that I define in SearchControllerExHandler are performed successfully in Spring Boot 2.2.7-Release. However, when I upgrade to Spring Boot 2.3.0-Release or Spring Boot 2.3.1-Release, the validation checks in SearchControllerExHandler are not being invoked.

I hope this is enough in terms of detail. If not, please let me know. I will share as much as I can.

Thank you again

Comment From: wilkinsona

@harjeetp Have you added a dependency on spring-boot-starter-validation, as described in the release notes for 2.3?

Comment From: spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: harjeetp

@harjeetp Have you added a dependency on spring-boot-starter-validation, as described in the release notes for 2.3?

Dear Andy,

I had not seen that note. I made the changes based on that note, and everything works as expected with the validation. Thank you for all your help.

Harjeet

Comment From: scottfrederick

@harjeetp Thanks for the update. Marking this as a duplicate of other validation-related issues.