关于apache cxf 结合Spring框架开发webservice服务

阅读更多
我在用apache cxf 结合Spring框架开发webservice服务时,遇到一个这样的问题,请大家帮忙解决一下,问题描述如下:

webservice启动配置如下

	
	
	
		
		
	



com.unicom.uniformdata.SqlExecuteServiceImpl类实现如下
@javax.jws.WebService(
                      serviceName = "SqlExecuteServiceService",
                      portName = "SqlExecuteServicePort",
                      targetNamespace = "http://uniformdata.unicom.com",
                      endpointInterface = "com.unicom.uniformdata.SqlExecuteService")
                      
public class SqlExecuteServiceImpl implements SqlExecuteService {
	private DaoHelper daoHelper = null;

	public SqlExecuteServiceImpl() {
		System.out.println("实例化webservice实现类");
		this.daoHelper =  GlobalVariable.getInstance().getDaoHelper();		
	}
}

public DaoHelper getDaoHelper() {
		return this.daoHelper == null ? (this.daoHelper = (DaoHelper) SpringUtils.getBean("daoHelper")): this.daoHelper;
	}

其中daoHelper类的配置是通过配置的,是数据库操作对象。但在Tomcat启动时,是先实例化SqlExecuteServiceImpl,而不是daoHelper,导致SqlExecuteServiceImpl实例化失败,webservice服务启动失败。这个问题怎么解决。对cxf框架也不是很熟,希望大家能帮助解决一下,谢谢!

你可能感兴趣的:(webservice,spring,cxf,实例化)