Hi,
I'm using CXF to generate a web service from wsdl. The generated web service has the annotation @WebService How do i get a reference to spring bean from the web service? All my spring beans are annotated with @Service, and I can access them in my web application. How do I access them also from my web service?
I've tried the following:
public class TestWSImpl implements TestWSSoap{
@Resource
public WebServiceContext wsContext;
@Override
public String getTest() {
ServletContext servletContext= (ServletContext) wsContext.getMessageContext().get(MessageContext.SERVLET_CONTEXT);
ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);
return "Test";
}
}
But the getWebApplicationContext method returns null
When I replace getWebApplicationContext with getRequiredWebApplicationContext I get an error message: No WebApplicationContext found: no ContextLoaderListener registered?
Anyone has an idea?
Thanks Alon