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

@@ -99,6 +99,14 @@ public class InitBinderDataBinderFactoryTests {
assertNull(dataBinder.getDisallowedFields());
}
@Test
public void createBinderNullAttrName() throws Exception {
WebDataBinderFactory factory = createBinderFactory("initBinderWithAttributeName", WebDataBinder.class);
WebDataBinder dataBinder = factory.createBinder(webRequest, null, null);
assertNull(dataBinder.getDisallowedFields());
}
@Test(expected=IllegalStateException.class)
public void returnValueNotExpected() throws Exception {
WebDataBinderFactory factory = createBinderFactory("initBinderReturnValue", WebDataBinder.class);