Merge pull request #2698 from top-zhang/v5-dev

fix: 修复 BeanUtil#copyProperties 源对象与目标对象都是 Map 时设置忽略属性无效问题
This commit is contained in:
Golden Looly
2022-11-08 20:04:32 +08:00
committed by GitHub
3 changed files with 58 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
package cn.hutool.core.bean;
import org.junit.Test;
import java.util.HashMap;
import java.util.Map;
/**
* https://github.com/dromara/hutool/issues/2697
*/
public class Issue2697Test {
@Test
public void mapToMapTest(){
Map<String, String> mapA = new HashMap<>(16);
mapA.put("12", "21");
mapA.put("121", "21");
mapA.put("122", "21");
Map<String, String> mapB = new HashMap<>(16);
BeanUtil.copyProperties(mapA, mapB, "12");
System.out.println(mapB);
}
}