[英]MyBatis Spring3 Mapper null with SoapClient
I have a ServiceXX.java with XXXMapper.java injected with @Autowire. 我有一个带有XXMapper.java并带有@Autowire的ServiceXX.java。 The ServiceXXX.java is a webservice @WebService(endpointInterface ="com.xxx...").
ServiceXXX.java是一个Web服务@WebService(endpointInterface =“ com.xxx ...”)。 When call the webservice with my java client everything seems to be wired correctly OK, but if call the webservice by SoapClient the XXXMapper is null.
当使用我的Java客户端调用Web服务时,一切似乎都正确连接了,但是,如果通过SoapClient调用Web服务,则XXXMapper为空。 Why?
为什么? :(
:(
It's likely due to the fact that the class declared as a @WebService
is being instantiated by your webservice stack of your container (not spring) so the context doesn't know about it for autowiring. 可能是由于以下事实:声明为
@WebService
的类正在容器的Web服务堆栈(不是spring)实例化,因此上下文不知道用于自动装配。 To remedy this, you can make your service class extend SpringBeanAutowiringSupport
. 为了解决这个问题,您可以使服务类扩展
SpringBeanAutowiringSupport
。 Then, spring will autowire it after it's initialized by the container. 然后,spring将在容器初始化之后自动对其进行接线。
That bean is in the spring-web
module, by the way. 顺便说一下,那个bean在
spring-web
模块中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.