SPR-6801 @ModelAttribute instantiation refinement.

Instantiate the model attribute from a URI var or a request param only
if the name matches and there is a registered Converter<String, ?>.
This commit is contained in:
Rossen Stoyanchev
2011-09-27 22:48:12 +00:00
parent 34956d30b3
commit b08c7f6e00
4 changed files with 136 additions and 42 deletions

View File

@@ -1607,9 +1607,8 @@ public String save(@ModelAttribute("account") Account account) {
<para>In this example the name of the model attribute (i.e. "account")
matches the name of a URI template variable. If you register
<classname>Converter&lt;String, Account&gt;</classname>
(or <classname>PropertyEditor</classname>) that can turn the
<literal>String</literal>-based account into an <classname>Account</classname>
<classname>Converter&lt;String, Account&gt;</classname> that can turn the
<literal>String</literal> account value into an <classname>Account</classname>
instance, then the above example will work without the need for an
<interfacename>@ModelAttribute</interfacename> method.</para>