...
The fact of including cxf-integration-cdi as a dependency allows JAXRSCdiResourceExtension portable CDI extension to be discovered by CDI container. The JAXRSCdiResourceExtension creates the instance of the Bus and registers it with BeanManager. From this point, the Bus instance is a regular CDI bean (with @Application scope) available for injection. This instance of the Bus is being injected into CXFCdiServlet servlet once it is initialized by servlet container.
Depending on the design, JAXRSCdiResourceExtension may use zero-based configuration approach or rely on particular JAX-RS application Application instances.
Zero-based Configuration
If the Apache CXF application contains only one single instance of JAX-RS Application (annotated with @ApplicationPath) with no singletons and classes defined, the following rules are being applied by JAXRSCdiResourceExtension in order to configure and publish the configured JAX-RS resources:
- the instance of the JAX-RS Application (annotated with @ApplicationPath) is being created and registered with BeanManager
- all instances of the JAX-RS providers (annotated with @Provider) are being created and registered with BeanManager
- all instances of the JAX-RS resources (annotated with @Path) are being created and registered with BeanManager