Results 1 to 4 of 4

Thread: DataBinder setAutoGrowNestedPaths(false) /no effect

  1. #1

    Default 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. #2

    Default 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

  3. #3
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,624

    Default

    Register a JIRA issue for that then it will get picked up, just dumping it here will probably not.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  4. #4

    Default Jira spr-6718


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •