'How to register a ContraintValidator with MockMvc?

I know this was asked before, but that was never really answered satisfactory.

How do you add a ContstraintValidator with MockMvc?

I expected to find something on the StandaloneMockMvcBuilder, as I was able to use it to add an argument resolver, but I don't see anything for it. There is setValidator() but that doesn't support a javax.validation.ContstraintValidator.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source