Open arjantijms opened 6 years ago
What are the details of the validation step done by Jersey?
@spericas
What are the details of the validation step done by Jersey?
Jersey creates a resource builder for the bean type using the IntrospectionModeller.
For this builder it indexes the path, method builders, child resource builders, resource methods, child resources and the sub resource locator, if any. If all of these are null or empty, the bean is not a JAX-RS resource.
While building this, it also does a number of validations. Among these are:
Specifically this means that if it encounters a CDI interceptor bean, which uses the following well known pattern:
@Inject
@Intercepted
private Bean<?> interceptedBean;
Then the validator will log a warning for this, even though the interceptor has nothing to do with JAX-RS or Jersey.
Jersey checks whether CDI beans are also JAX-RS resources, and if so modifies their injection points. For this check it shouldn't validate a CDI bean according to JAX-RS rules, if it's not a JAX-RS resource.
Practically, this often results in useless warnings, but it can even result in exceptions preventing deployments.