【发布时间】: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