-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
Sam Brannen opened SPR-6437 and commented
When using @Valid to drive automatic validation of a model object, it is currently not possible to modify the bound model object prior to validation.
With the SimpleFormController hierarchy it was straightforward to override BaseCommandController's onBind() or onBindAndValidate() methods to achieve custom binding; however, with @MVC it is currently not possible. Neither the WebBindingInitializer API nor an @InitBinder method provides a mechanism to plug in custom binding.
Note that this was not an issue prior to support for @Valid, since without @Valid developers were responsible for executing validation code within a handler method.
One possible solution would be to add support for an @PostBinding method or @PreValidation method (or similar) which would be allowed to modify the model after binding but prior to executing the handler method.
Affects: 3.0 RC2
Issue Links:
- Support for interception of controller method invocation after binding has completed [SPR-7793] #12449 Support for interception of controller method invocation after binding has completed ("is duplicated by")
- Integrating validation into the @MVC request lifecycle [SPR-5417] #10091 Integrating validation into the
@MVCrequest lifecycle - @MVC should provide a way to invoke custom code at preBind stage [SPR-6472] #11138
@MVCshould provide a way to invoke custom code at preBind stage
6 votes, 6 watchers