I have copied the code from the CXF manual to get access to the
ServletContext of either the SOAP or REST call and it works ok. However,
I naturally have more that one Service to implement, so I wanted to move
this code to an abstract parent class. When the code is there, only the
SOAP resource is injected, the REST variable is NULL.

Or if you don't mind coupling your classes to Spring you can sidestep
all of this by just having your abstract parent class implement
ServletContextAware, then Spring will inject the context for you without
any of the CXF infrastructure needing to be involved.

Unlike 99% of all other Java developers (or at least I get that impression) I'm not a great fan of Spring. On one hand I do not like programming-by-configuration that much, because it is not compiler checkable, and on the other hand Spring never gave me the feeling of being "simple". But that may just be me. Spring gives me the same feeling Maven does; "oh oh"... But I ended up diving into Maven anyhow and maybe it is not that complex... But it most definitely is not simple, and I like simple.

So, no, I would prefer to stick to the standard JAX-* instead of adding Spring to the dependency list.

Tom

Reply via email to