Our project runs on JBoss 6 with Spring 3.0.5. Everything went smoothly until we tried to implement some web services with JAX-WS. If I try to make some simple WS (for example, adding 2 numbers), it just works - I put annotations and add an annotated class as a servlet. But things get more complicated if I try to make my JAX-WS classes populate with dependencies.
Here is my code:
@WebService(name = "principal")
public class PrincipalWebService extends SpringBeanAutowiringSupport {
@Autowired
private PrincipalManager manager;
@WebMethod
public int add(int a, int b) {
return a + b;
}
@WebMethod
public Principal getById(int i) {
return manager.getById(i);
}
}
The add method works, but getById does not work with NPE. I was debugging SpringBeanAutowiringSupport and it looks like ContextLoader.getCurrentWebApplicationContext () is returning null. This means that the SpringBeanAutowiringSupport constructor is called before the context is initialized.
CXF Spring. , PrincipalWebService bean, Spring CXF bean ID . Jetty, JBoss. , CXF, - JBoss 6 CXF Spring 2.5, .
- , IoC Jax-ws- JBoss 6?