Discussions regarding how in detail CDI is used by JAX-RS have not started yet and will happen for JAX-RS 2.3 (aim: JAX-RS engines must support CDI) and 3.0 (aim: applications must be CDI compliant). Please see our roadmap https://github.com/eclipse-ee4j/jaxrs-api/wiki/Roadmap.
The JAX-RS 2.1 specification does not mandate that custom Application classes must be CDI-instantiable, which is a prerequisite for what you ask for. This is currently up to the application author to decide. This might be enforced with specification JAX-RS 3.0 or later.
*If* the application subclass actually is CDI compliant (again, which is not mandatory yet), and *if* the JAX-RS engine supports CDI, the application MUST get registered in the CDI context by the JAX-RS engine. But *how* the JAX-RS engine performs this is not specified in the JAX-RS 2.1 specification. The use of CDI to even instantiate the application might be enforced with specification JAX-RS 2.3 or later.
-Markus
From: jaxrs-dev-bounces@xxxxxxxxxxx [mailto:jaxrs-dev-bounces@xxxxxxxxxxx] On Behalf Of Laird Nelson
Sent: Samstag, 23. Februar 2019 22:10
To: jaxrs-dev@xxxxxxxxxxx
Subject: [jaxrs-dev] Clarification regarding Application subclass instantiation
Hello, JAX-RSers:
Section 11.2.3 of the JAX-RS 2.1 specification says in part:
"In a product that supports CDI, implementations MUST support the use of CDI-style Beans as root resource classes, providers and Application subclasses."
Does this mean that it MUST be possible in such a product for an Application subclass to be instantiated by CDI?