尝试从使用共享约束的域类导入约束时,我得到以下异常。绑定阶段出现异常
例外:
Property [somePackage.User.email] references shared constraint [email:null], which doesn't exist!
领域:
class User {
String email
static constraints = {
email(shared: 'email', unique: true)
}
命令
class UpdateClientCommand {
String email
static constraints = {
importFrom User
}
}
堆栈跟踪:
Property [clearhub.User.email] references shared constraint [email:null], which doesn't exist!. Stacktrace follows:
Caused by: org.grails.core.exceptions.GrailsConfigurationException: Property [mypackage.User.email] references shared constraint [email:null], which doesn't exist!
at org.grails.validation.DefaultConstraintEvaluator.applySharedConstraints(DefaultConstraintEvaluator.java:287)
at org.grails.validation.DefaultConstraintEvaluator.evaluateConstraintsMap(DefaultConstraintEvaluator.java:245)
at org.grails.validation.DefaultConstraintEvaluator.evaluateConstraints(DefaultConstraintEvaluator.java:132)
at org.grails.validation.DefaultConstraintEvaluator.evaluateConstraints(DefaultConstraintEvaluator.java:119)
at org.grails.validation.DefaultConstraintEvaluator.evaluate(DefaultConstraintEvaluator.java:80)
at org.grails.validation.ConstrainedPropertyBuilder.handleImportFrom(ConstrainedPropertyBuilder.java:173)
at org.grails.validation.ConstrainedPropertyBuilder.createNode(ConstrainedPropertyBuilder.java:165)
at groovy.util.BuilderSupport.doInvokeMethod(BuilderSupport.java:101)
at org.grails.validation.ConstrainedPropertyBuilder.doInvokeMethod(ConstrainedPropertyBuilder.java:72)
at groovy.util.BuilderSupport.invokeMethod(BuilderSupport.java:67)
at mypackage.UpdateClientCommand$__clinit__closure1.doCall(ClientController.groovy:47)
at org.grails.validation.DefaultConstraintEvaluator.evaluateConstraintsMap(DefaultConstraintEvaluator.java:240)
at org.grails.validation.DefaultConstraintEvaluator.evaluateConstraints(DefaultConstraintEvaluator.java:144)
at org.grails.validation.DefaultConstraintEvaluator.evaluate(DefaultConstraintEvaluator.java:92)
at grails.validation.Validateable$Trait$Helper.validate(Validateable.groovy:149)
at grails.validation.Validateable$Trait$Helper.validate(Validateable.groovy:82)
... 37 common frames omitted
有任何想法吗 ?