标签:style ar os sp on bs as line size
要对静态变量进行注入
@Resource
private static ITecharchService techarchService;//注入为空,spring注解注入不支持静态变量注入
查资料找到可以这样注入
@Component //必须是组件,才可以用@PostConstruct
public class DDUtils{
@Resource
private ITecharchService techarchService;
private static DDUtils dd;
@PostConstruct
public void init() {
dd = this;
dd.techarchService= this.techarchService;
}
public void getA(){
//调用
dd.techarchService.getA();
}
}
标签:style ar os sp on bs as line size
原文地址:http://blog.csdn.net/xiaobingtao/article/details/41861973