-
Notifications
You must be signed in to change notification settings - Fork 38.9k
mergePropertiesIntoMap only works with String [SPR-5669] #10340
Copy link
Copy link
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancementA general enhancement
Milestone
Description
Nanda Firdausi Muhammad opened SPR-5669 and commented
mergePropertiesIntoMap only works well with String. If the value of the properties is non-String, the returned value is always null.
The problem is that this method is also used for a non-String value, for example in org.springframework.web.servlet.handler.SimpleUrlHandlerMapping.setMappings(Properties)
Check with this test:
public void testMergePropertiesIntoMap2() {
Object obj1 = new Object();
Object obj2 = new Object();
Object obj3 = new Object();
Properties defaults = new Properties();
defaults.put("prop1", obj1);
Properties props = new Properties(defaults);
props.put("prop2", obj2);
Map map = new HashMap();
map.put("prop3", obj3);
CollectionUtils.mergePropertiesIntoMap(props, map);
assertEquals(obj1, map.get("prop1"));
assertEquals(obj2, map.get("prop2"));
assertEquals(obj3, map.get("prop3"));
}
Affects: 3.0 M2
Issue Links:
- YAML + PropertyPlaceholderConfigurer needs to process non-String values as well [SPR-14737] #19303 YAML + PropertyPlaceholderConfigurer needs to process non-String values as well
Referenced from: commits 8ee0363
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancementA general enhancement