在用Spring+CXF开发webservice的时候发现一个问题,CXF监听之后的实现类不能注入Dao,在网上查了点别人的资料,解决了问题
首先Spring的注入配置还是像一般的Spring一样注入
spring-config_ruleService.xml
<!-- 把产品信息的DAO的对象注入到service中 -->
<bean id="RuleService" class="com.xxx.service.ruleWebservice.impl.RuleServiceImpl">
<!-- 注入Dao实例 -->
<property name="ruleServiceDao" ref="ruleServiceDao"></property>
</bean>
<!-- 实例化Hibernate实现DAO -->
<bean id="ruleServiceDao" class="com.xxx.dao.extend.impl.RuleServiceDaoImpl" parent="daoTemplate" />
不过CXF的配置文件要有注意的地方
cxf/webservice.xml
<!-- cxf的配置文件 -->
<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" />
<!-- 注册对外接口 implementor是实现类 address是web service地址 -->
<jaxws:endpoint id="ruleService"
implementorClass="com.xxx.service.ruleWebservice.RuleService"
implementor="#RuleService" address="/ruleService" />
注意这个配置implementorClass就是配置这个service的interface,然后implementor就是去引用Spring容器中的RuleService这个bean,这样配置,就能在webservice的实现service中注入dao了。
分享到:
相关推荐
idea+maven+spring+cxf
Spring+CXF+MyBatis整合代码,运行即可使用。
Spring + cxf = webservice 完整实例源码免费下载 完全免费。此资源仅为文档提供。 版权为百度文档 "Spring + cxf = webservice 完整实例源码免费下载" 所有。
最新cxfWebservice服务整合,其中整合的框架有mybatis+srping3+cxf2.6.3大家可以参考一下,绝对可用信不信只有下载,瞧了才知道!
Spring+CXF+tomcat开发webservice,包含服务端和客户端,导入myeclipse就可以用。帮助大家搭建webservice框架,实现webservice功能。
Web项目中基于Maven与Spring整合的WebService之cxf的实现⬇️ 详情请参考如下链接: https://locqi.github.io/locqi.com/2018/09/05/Eclipse+Maven+Spring+CXF-create-WebService/
spring+cxf 完整的整合jar包,下载下来就能用,很全面
spring + cxf + mybatis整合
spring+cxf_demo
Spring+cxf配置接口+mybatis配置
CXF+spring+struts实现WebService
Spring+CXF+MyBatis整合客户端代码
本java工程实现了spring+cxf快速开发webservice jar包齐全导入myeclipse可直接二次开发
使用idea创建maven项目组建spring+cxf 客户端使用idea创建java Enterprise 中的WebServices Client进行创建
spring+cxf 入门demo 包括spring配置,web配置,代码实现,简单易懂
最近开发了一个基于ssm(Spring+SpringMVC+Mybatis)的项目,整合了CXF发布webservice。现在来分享项目源码,希望能帮助到有需要的朋友。
maven+spring+cxf+mybatis 搭建的webservice项目
spring与cxf的资料,整合spring与cxf的资料
SpringBoot+Mybatis+CXF框架,实现Restful api与 WebService api接口的大实验
ibatis+spring+cxf+mysql搭建webservice的客户端,文章地址在http://blog.csdn.net/cenyi2013/article/details/17315755. 服务端源码的下载地址在http://download.csdn.net/detail/cenyi2012/6712729