webService调用spring配置文件中的bean为空问题!!

向天再借1分钱 2015-10-12 02:57:07
问题:

A项目中有配置好的spring bean文件(该文件配置没问题,在A项目中使用正常)。
部分bean文件代码:
<bean id="guaranteeApplyService" class="com.supporter.prj.bm.guarantee.service.GuaranteeApplyService">
</bean>

现在A项目中添加基于cxf的webservice接口:
配置文件:

<?xml version="1.0" encoding="UTF-8"?>

<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" />
<import resource="bm_guarantee-service.xml"/>


<jaxws:endpoint id="GuaranteeApplyWebServiceZjMa"
address="/GuaranteeApplyWebServiceZjMa"
implementor="com.supporter.prj.bm.webservice.guaranteeApply.GuaranteeApplyWebServiceZjMaImpl">
</jaxws:endpoint>
</beans>


接口实现类代码:

@WebService(endpointInterface = "com.supporter.prj.bm.webservice.guaranteeApply.GuaranteeApplyWebServiceZjMa", serviceName = "GuaranteeApplyWebServiceZjMa")
public class GuaranteeApplyWebServiceZjMaImpl implements GuaranteeApplyWebServiceZjMa {
@Autowired
GuaranteeApplyService guaranteeApplyService;
@Override
public String getGuaranteeApplyRecord() {

System.out.println("aaaaaaaaaaaaa"+guaranteeApplyService);

}


项目启动不报错,只是System.out.println("aaaaaaaaaaaaa"+guaranteeApplyService); 输出调用的guaranteeApplyService为空!!

在线急等,求帮助,万分感谢!!!

...全文
342 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
InHereWolf 2018-08-29
  • 打赏
  • 举报
回复

<jaxws:endpoint id="webService" implementor="#objectAccessor" address="/WebService"></jaxws:endpoint>

乱码艺术 2016-08-12
  • 打赏
  • 举报
回复
楼主解决了?我也遇到了,怎么解决的方案贴出来,谢谢.
zjy6829787 2015-10-13
  • 打赏
  • 举报
回复
引用 2 楼 qq_18380207 的回复:
[quote=引用 1 楼 zjy6829787 的回复:]
ContextLoader.getCurrentWebApplicationContext().getBean("guaranteeApplyService")
这个试试


问题是我有个dao层,如果不能用注解,而是用你这种方式,我需要源码重写,工程量太大[/quote]

guaranteeApplyService里注入dao了么?没事吧,这个方法获取的bean会注入的
  • 打赏
  • 举报
回复
引用 1 楼 zjy6829787 的回复:
ContextLoader.getCurrentWebApplicationContext().getBean("guaranteeApplyService")
这个试试


问题是我有个dao层,如果不能用注解,而是用你这种方式,我需要源码重写,工程量太大
zjy6829787 2015-10-12
  • 打赏
  • 举报
回复
ContextLoader.getCurrentWebApplicationContext().getBean("guaranteeApplyService")
这个试试

50,639

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧