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

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

webservice启动配置如下
<beans xmlns="http://www.springframework.org/schema/beans" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">

<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<jaxws:endpoint id="sqlExecuteService"
implementor="com.unicom.uniformdata.SqlExecuteServiceImpl"
address="/DesServer">
</jaxws:endpoint>
</beans>



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类的配置是通过<bean>配置的,是数据库操作对象。但在Tomcat启动时,是先实例化SqlExecuteServiceImpl,而不是daoHelper,导致SqlExecuteServiceImpl实例化失败,webservice服务启动失败。这个问题怎么解决。对cxf框架也不是很熟,希望大家能帮助解决一下,谢谢!
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值