不使用@Resource注入WebServiceContext [英] WebServiceContext is not injected using @Resource

查看:862
本文介绍了不使用@Resource注入WebServiceContext的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道以前曾经问过,但没有一个解决方案适合我。可能是因为他们大多使用符合EE标准的应用服务器,我的情况

I know that has been asked before, but none of the solutions worked for me. Probably because they were mostly using EE compliant application servers, which is NOT my case.

我在码头上运行我的网络服务(通过Eclipse)仅用于开发。但即使是部署,我也会使用Tomcat 7.因此,无论是开发还是生产,我都不会使用符合JavaEE标准的服务器。

I'm running my web service on jetty (through Eclipse) for development only. But even for deployment, I'll use Tomcat 7. So for either development or production, I won't be using a JavaEE compliant server.


  • 那么仍然可以将 WebServiceContext 注入我的web
    服务吗?

  • So is it still possible to inject WebServiceContext into my web services ?

我尝试过以下但是没有用

I've tried the following but it didn't work

@WebService
@BindingType(SOAPBinding.SOAP12HTTP_BINDING)
public class IxProIntegration {
    // Tried this, didn't work
    @Resource
    private WebServiceContext wsContext;

    // After commenting the @Resource annotation on the wsContext field
    // And adding the annotation here, this still didn't work.
    @Resource
    @WebMethod(exclude = true)
    public void setContext(WebServiceContext context) {
        this.wsContext = context;
    }




  • 当有人给出答案时,我会很想知道从
    那里得到的答案?

  • 推荐答案

    我'使用名为Tapestry的依赖注入框架。 Tapestry正在管理服务实例化。但是Web服务不是由JAX-WS管理的。这就是上下文总是 null 的原因。我询问了与该主题相关的新问题,以防有人需要答案。

    I'm using a dependency injection framework called Tapestry. Tapestry is managing the service instantiatiion. But the web service isn't managed by JAX-WS. That's why the context is always null. I asked a new question related to the subject, in case someone needs an answer.

    这篇关于不使用@Resource注入WebServiceContext的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆