Skip to content

mergePropertiesIntoMap only works with String [SPR-5669] #10340

@spring-projects-issues

Description

@spring-projects-issues

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:

Referenced from: commits 8ee0363

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions