You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Respect 'merge' attribute of <map> and <list> elements in conjunction with nested property paths [SPR-9552] #14186
My hope is to get X and C in the child map. When I do this, however, all I get is C. I have asked for guidance on the forums but did have any responses, which leads me to believe that this is a bug. Please let me know if there is any additional information I can provide.
I placed the priority as Major because I don't have a workaround for this.
I would expect reference1.list to have 4 items, but it only has the two items val3 and val4. I think the issue is when property values are merged between the child and parent definitions, they only merge properties with the same name (do not consider nested). This is the only place I found where merging was considered."
Is this something you're planning to add? If so, which version do you anticipate releasing it?
We were wondering if there has been any work done on this or if the task is scheduled? This seems like a big issue with the framework. Not being able to use nested properties with merging means you have to copy the entire nested bean from a parent in order to add to a property.
I've just reproduced this problem, as demonstrated in the SPR-9552 branch, and specifically with commit f43d12c663. While it's arguable whether this issue is a bug or an improvement request, I've marked it as an improvement, as there's nothing wrong with existing functionality and it was never specifically documented that merge should work with nested property paths. I've marked this issue as pull-request-encouraged to let contributors know that this is a relatively straightforward and discrete issue that we'd love to have implemented, but may not have time to get to immediately.
I did some digging and found that during the bean merge process the parent bean would have property values that contained BeanDefinition objects for all the nested beans. The child bean would have a property with the nested name (e.g. beanA.beanB.propertyName). When it came time to find the nested property it would be done by a simple name match which would fail to match any of the properties in the parent bean.
I have modified MutablePropertyValues to recognize the nested property name of the child property and to walk through the chain of nested beans to locate the property and add or merge as appropriate.
I have created a JUnit test case based on Chris Beams earlier work.
At this point, I'm inclined to leave things as-is with respect to XML collection merging, since it only matters in combination with a feature of decreasing popularity: parent bean definitions. If there's a strong need for this appear in our XML configuration story in 2016 still, feel free to comment on this issue. If we don't hear about strong use cases in time for 4.3, we'll close the ticket for good.
Activity
spring-projects-issues commentedon Sep 6, 2012
Matt Wuertz commented
A note from another team member:
"I found out that merging of nested lists does not work as well. For example:
I would expect reference1.list to have 4 items, but it only has the two items val3 and val4. I think the issue is when property values are merged between the child and parent definitions, they only merge properties with the same name (do not consider nested). This is the only place I found where merging was considered."
Is this something you're planning to add? If so, which version do you anticipate releasing it?
spring-projects-issues commentedon Jan 6, 2013
Jerry Neal commented
Hi,
We were wondering if there has been any work done on this or if the task is scheduled? This seems like a big issue with the framework. Not being able to use nested properties with merging means you have to copy the entire nested bean from a parent in order to add to a property.
thanks,
Jerry
spring-projects-issues commentedon Jan 7, 2013
Chris Beams commented
Hi Matt, Jerry,
I've just reproduced this problem, as demonstrated in the SPR-9552 branch, and specifically with commit f43d12c663. While it's arguable whether this issue is a bug or an improvement request, I've marked it as an improvement, as there's nothing wrong with existing functionality and it was never specifically documented that
mergeshould work with nested property paths. I've marked this issue aspull-request-encouragedto let contributors know that this is a relatively straightforward and discrete issue that we'd love to have implemented, but may not have time to get to immediately.Thanks!
spring-projects-issues commentedon Jan 7, 2013
Jerry Neal commented
Hi Chris,
Thank you so much for taking a look at this. It would be a good improvement making nested properties more powerful.
thanks,
Jerry
spring-projects-issues commentedon Mar 3, 2014
Chris Baldwin commented
I did some digging and found that during the bean merge process the parent bean would have property values that contained BeanDefinition objects for all the nested beans. The child bean would have a property with the nested name (e.g. beanA.beanB.propertyName). When it came time to find the nested property it would be done by a simple name match which would fail to match any of the properties in the parent bean.
I have modified MutablePropertyValues to recognize the nested property name of the child property and to walk through the chain of nested beans to locate the property and add or merge as appropriate.
I have created a JUnit test case based on Chris Beams earlier work.
The proposed changes can be viewed on my SPR-9552 branch.
spring-projects-issues commentedon Mar 4, 2014
Chris Baldwin commented
There is now a pull request for the changes.
spring-projects-issues commentedon Feb 1, 2016
Juergen Hoeller commented
At this point, I'm inclined to leave things as-is with respect to XML collection merging, since it only matters in combination with a feature of decreasing popularity: parent bean definitions. If there's a strong need for this appear in our XML configuration story in 2016 still, feel free to comment on this issue. If we don't hear about strong use cases in time for 4.3, we'll close the ticket for good.
Juergen