-
Notifications
You must be signed in to change notification settings - Fork 18
Description
When using command objects a few things don't work correctly.
- auto wiring.
when a custom validator needs to access a service defined in the command object (same might be for domain object), the service instance variable has not been injected before calling the custom validator.
in JQueryRemoteValidatorController.groovy
import org.springframework.beans.factory.config.AutowireCapableBeanFactory
and add this after initiating validatableInstance in the method validate() around line 41
applicationContext.autowireCapableBeanFactory.autowireBeanProperties(validatableInstance,AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, false)
- command objects don't respond to isAttached
in same method validate() around line 57 replace
if(validatableInstance.isAttached()) validatableInstance.discard()
by
if(validatableInstance.metaClass.respondsTo(validatableInstance, "isAttached") && validatableInstance.isAttached())
validatableInstance.discard()
Hope that helps
Regards
Pascal