首先 Spring 的注入配置还是像一般的 Spring 一样注入
<!-- 实例化Hibernate实现DAO -->
<beanid="ruleServiceDao" class="com.xxx.dao.extend.impl.RuleServiceDaoImpl" parent="daoTemplate" />
<!-- DAO的对象注入到service中-->
<beanid="RuleService"class="com.xxx.service.ruleWebservice.impl.RuleServiceImpl">
<!-- 注入Dao实例 -->
<propertyname="ruleServiceDao"ref="ruleServiceDao"></property>
</bean>
不过CXF的配置文件要有注意的地方
cxf/webservice.xml
<!-- cxf的配置文件 -->
<importresource="classpath:meta-inf/cxf/cxf.xml" />
<importresource="classpath:meta-inf/cxf/cxf-extension-soap.xml" />
<importresource="classpath:meta-inf/cxf/cxf-servlet.xml" />
<!--注册对外接口 implementor是实现类 address是web service地址 -->
<jaxws:endpointid="ruleService"
implementorClass="com.xxx.service.ruleWebservice.RuleService"
implementor="#RuleService"address="/ruleService" />
注意这个配置implementorClass就是配置这个service的interface,然后implementor就是去引用spring容器中的RuleService这个bean,这样配置,就能在webservice的实现service中注入dao了。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。