@Valid is not getting invoked if I use @PreAuthorize method level security

前端 未结 1 511
心在旅途
心在旅途 2021-01-23 18:01

Following is a code snippet from my controller:

@RestController
@RequestMapping(Constants.REST_CONTROLLER_ENDPOINT)
class ProductRestController {

private final          


        
相关标签:
1条回答
  • 2021-01-23 18:31

    Turns out that the @InitBinder method needs to be public for the validation to be invoked:

    @InitBinder
    public void initBinder(WebDataBinder binder) {
    binder.setValidator(productValidator);
    }
    
    0 讨论(0)
提交回复
热议问题