Yes, I'm familiar with the desired direction. I'm restricting my question to 2.1 (and possibly 2.2).
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.
Actually, doesn't section 11.2.3 explicitly mandate this? That an Application subclass must either be a singleton or in application scope?
Let's just talk about application scope: If my Application subclass is declared like this:
@ApplicationScoped
public MyApp extends Application {
// ...
}
…CDI is quite clear about what that means (without any reference to JAX-RS), and one of those things is that I must be able to do (for example):
final Bean<?> applicationBean = beanManager.resolve(beanManager.getBeans(Application.class));
final Application app = beanManager.getReference(applicationBean, Application.class, beanManager.createCreationalContext(applicationBean));
In the interest of clarity, are you saying that section 11.2.3 says something different?
This is currently up to the application author to decide.
Could you point to the specification language that I've missed that says that? I'd like to learn more how section 11.2.3 doesn't cover this.
Best,
Laird