Skip to content

Commit 4d825ce

Browse files
reorder command object DI
Dependency injection should happen before validation
1 parent 1e8417f commit 4d825ce

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/java/org/codehaus/groovy/grails/web/plugins/support/WebMetaUtils.groovy

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ class WebMetaUtils {
113113
}
114114

115115
bind.invoke(commandObject, "bindData", [commandObject, commandParams] as Object[])
116+
if(newCommandObject) {
117+
ctx.autowireCapableBeanFactory?.autowireBeanProperties(
118+
commandObject, AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, false)
119+
}
116120
def errors = commandObject.errors ?: new BindException(commandObject, paramType.name)
117121
def constrainedProperties = commandObject.constraints?.values()
118122
for (constrainedProperty in constrainedProperties) {
@@ -122,10 +126,6 @@ class WebMetaUtils {
122126
}
123127
commandObject.errors = errors
124128

125-
if(newCommandObject) {
126-
ctx.autowireCapableBeanFactory?.autowireBeanProperties(
127-
commandObject, AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, false)
128-
}
129129
}
130130
catch (Exception e) {
131131
throw new ControllerExecutionException("Error occurred creating command object.", e)

0 commit comments

Comments
 (0)