这种在注入map类型的testMap时,如果使用
setTestMap(String value){ this.testMap.put(value,value) }
会报空指针异常。
修改为
setTestMap(String value){ Map<String,String> tomap = new HashMap<~>(); tomap.put(value,value); this.testMap = tomap; }
会解决问题
这种在注入map类型的testMap时,如果使用
setTestMap(String value){ this.testMap.put(value,value) }
会报空指针异常。
修改为
setTestMap(String value){ Map<String,String> tomap = new HashMap<~>(); tomap.put(value,value); this.testMap = tomap; }
会解决问题