【问题标题】:SOAPHandler and Spring AutowireSOAPHandler 和 Spring Autowire
【发布时间】:2014-12-18 12:49:41
【问题描述】:

我正在尝试将 Spring 服务注入 SOAPHandler,但引用始终为空。

我尝试扩展 SpringBeanAutowiringSupport 并使用:

public class FuelServiceSOAPHandlerBase extends SpringBeanAutowiringSupport implements SOAPHandler<SOAPMessageContext>, InitializingBean {
    @Autowired
    private AuthenticationService authenticationService;

    @Override
    @PostConstruct
    public void afterPropertiesSet() throws Exception {
        LOG.info("AuthenticationHandler - PostConstruct");
        SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
    }
    ....
}

它不起作用,authenticationService 始终为空。我也试图让 Bean throw

authenticationService = WebApplicationContextUtils.getWebApplicationContext(((HttpServletRequest)context.getMessage().getProperty(MessageContext.SERVLET_REQUEST)).getSession().getServletContext()).getBean(FuelAuthenticationService.class);

但是 ServletRequest 为空。我正在执行 Webservice-Call throw SOAPUI。

有人知道错误是什么吗?

谢谢

【问题讨论】:

    标签: spring autowired soaphandler


    【解决方案1】:

    我使用@Resource 而不是@Autowire 解决了

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-09-22
      • 1970-01-01
      • 2014-07-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-29
      • 1970-01-01
      相关资源
      最近更新 更多