-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Description
Currently (Spring 5.2) we can not use constructor based bean binding of path variables as we can with request parameters. This is somewhat an inconsistent way of binding url data. Bean property binding is supported for both types of parameters but therefor a mutable object is required.
In method constructAttribute
(ModelAttributeMethodProcessor.java:277
) the values for constructor parameters are only taken from webRequest.getParameterValues(paramName)
so no path variables are taken into account here. It's only when that constructed attribute object is bind by bindRequestParameters(binder, webRequest)
in method resolveArgument
(ModelAttributeMethodProcessor.java:160
) that the path variables (as well as the request parameters again) are eventually added for bean property binding in method ServletRequestDataBinder#bind
.
I mentioned this problem in issue 22600 and was correctly advised to create a separate issue for this to avoid a mixed conversation.