spring map使用annotation泛型注入问题分析 (四)

2014-11-24 11:39:10 · 作者: · 浏览: 19
set方法注入,不要在set方法上使用antowired


[java]
public void setTypeMap(Map typeMap) {
this.typeMap = typeMap;
}

public void setTypeMap(Map typeMap) {
this.typeMap = typeMap;
}


[java]
/构造方法注入
public HelloServiceImpl(String greetting,Map typeMap){
this.greetting = greetting;
this.typeMap = typeMap;
System.out.println("call HelloServiceImpl constructor" + this.greetting);
}

//构造方法注入
public HelloServiceImpl(String greetting,Map typeMap){
this.greetting = greetting;
this.typeMap = typeMap;
System.out.println("call HelloServiceImpl constructor" + this.greetting);
} [java] view plaincopyprint


COO


CFO


CEO