I have big controller with different methods.
I implement custom validator using org.springframework.validation
Hove to 'disable' validation for some controller methods? Or choose method - validator map.
For now - validation applied for all methods. And error:
Invalid target for Validator
Methods with validation:
@RequestMapping( value = "/" + API_METHOD_NAME_LIST_PLAYERS, method = RequestMethod.POST )
public CResponseEntityWithView< CDefaultResponseBody< ?, ? > > listPlayers( CRequestList request ) {
@RequestMapping( value = "/" + API_METHOD_NAME_UPDATE, method = RequestMethod.POST )
public CResponseEntityWithView< CDefaultResponseBody< ?, ? > > updatePlayer( @Valid @RequestBody CRequestUpdate request )
For last - I've added validator:
@InitBinder
private void initBinder(WebDataBinder binder) {
binder.setValidator(validator);
}
I no need to validate both requests. Only second.