0
class Person{
Map sons;
Map getSons(){
return sons;
}
}
class Test{
public void Main(){
Person p=new Person();
Map sons=new HashMap<String,Person>();
sons.add("jack",new Person());
..... // here use guice to inject this Map object to p,how to do it?
System.out.print(new Person().getSons().count());
}
}
就像代碼顯示的一樣,如何通過guice將現有的Map對象注入到bean中?如何通過guice注入一個Map對象?
你在'Person'字段上使用行類型'Map sons',對嗎? –
通用課程! –