Announcement Announcement Module
Collapse
No announcement yet.
DataBinder setAutoGrowNestedPaths(false) /no effect Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • DataBinder setAutoGrowNestedPaths(false) /no effect

    Spring 3.0.0. introduced the property autoGrowNestedPaths to allow a data binder to automatically create nested objects that are not yet there.
    However, calling:
    dataBinder.setAutoGrowNestedPaths(false);
    has no effect.

    I see in the debugger that the dataBinder.autoGrowNestedPaths is false but the binding result's ( BeanPropertyBindingResult) corresponding property is true. We set autoGrowNestedPaths = false before binding!

    Our code that worked fine in Spring 2.5 doesn't work anymore as new nested objects are being created even though we've set dataBinder.autoGrowNestedPaths = false.

    e.g.
    try {
    return dataBinder.getBindingResult().getFieldValue(name);
    } catch (NullValueInNestedPathException ex) {
    // Can happen when root or intermediate objects are null
    }

  • #2
    it works but...

    I found that you have to immediately set the property after construction.

    DataBinder dataBinder = new DataBinder(model, modelName);
    dataBinder.setAutoGrowNestedPaths(false);

    You even have to setautoGrowNestedPaths = false before you register any custom editors as in my case the BindingResult was being created before I set autoGrowNestedPaths = false;

    To be compatible with Spring < 3.0 I think the default should be autoGrowNestedPaths = false

    Comment


    • #3
      Register a JIRA issue for that then it will get picked up, just dumping it here will probably not.

      Comment


      • #4
        Jira spr-6718

        I added it to JIRA
        http://jira.springframework.org/browse/SPR-6718

        Comment

        Working...
        X