我正在尝试将 Spring Service 注入 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 始终为空。我也尝试过扔豆子
authenticationService = WebApplicationContextUtils.getWebApplicationContext(((HttpServletRequest)context.getMessage().getProperty(MessageContext.SERVLET_REQUEST)).getSession().getServletContext()).getBean(FuelAuthenticationService.class);
但是 ServletRequest 为空。我正在执行 Webservice-Call throw SOAPUI。
有谁知道错误是什么?
谢谢