WebService注入为空的问题

来源:互联网 发布:three.js源码下载 编辑:程序博客网 时间:2024/05/17 07:06

要把项目里的业务层,用 WebService 有选择的发布出来.

碰到调用 WebService 发布的服务时,业务层中 Spring 注入的 Bean 都为空的情况.

问题分析, 业务层 Bean 使用的 Spring 容器和调用 WebService 服务中使用的不是同一个 Spring 容器. 

所以,在 WebService 中获得不到已经注入的业务 Bean

解决办法:

<jaxws:endpoint id="applicationService"
        implementorClass="cn.jbit.cxf.service.impl.ApplicationServiceImpl" 

                  address="/applicationService" >
    <jaxws:implementor ref="appli"/>
</jaxws:endpoint>

 

一般的是

<jaxws:endpoint id="applicationService"
  implementor="cn.jbit.cxf.service.impl.ApplicationServiceImpl" address="/applicationService" />

原创粉丝点击