JAX-RS annotation on interface
See original GitHub issueHello, I am working on an 1.0 implementation where I am using Jersey for Jax-rs implementation and Weld for CDI, but I have encountered a problem:
Jersey does not support JaxRs annotations on interfaces (which is by specification jsr370-2.1 chapter 3.6) if they are not implemented. Therefore when I try to run example I get
org.jboss.weld.exceptions.IllegalArgumentException: WELD-001508: Cannot create an InjectionTarget from
[EnhancedAnnotatedTypeImpl] public abstract interface @RegisterRestClient @Produces
@Dependent @Consumes @Path class app.services.RestApi as it is an interface
If I override my Application class with getClasses()
method and put valid resources without RC interface I get it working, however if I do not do that, then automatic scan picks up RC interface as well and I get previously mentioned exception.
Is there any way I can make a workaround for this Jersey limitation?
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
How to annotate JAX-RS on an interface while using Jersey
Use a ResourceConfig and do a registerClasses(MyImplementation. · Disable the package scanning configuration in web. · use a ResourceConfig and ...
Read more >Developing a JAX-RS RESTful Service - dennis-xlc
A JAX-RS service is a Java class that uses JAX-RS annotations to bind and map specific incoming HTTP requests to Java methods that...
Read more >JAX-RS - Annotation Inheritance - LogicBig
JAX -RS annotations may be used on the methods and method parameters of a super-class or an implemented interface.
Read more >29.2 Creating a RESTful Root Resource Class
Request method designator annotations are runtime annotations, defined by JAX-RS, that correspond to the similarly named HTTP methods. Within a resource class ...
Read more >Process JAX-RS annotations on interfaces #1427 - GitHub
In our project, we have jax-rs (jersey) interfaces and implementations. As the interfaces are shared, I do not want to put any annotation...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It seems that we hit a similar problem with our Payara Micro implementation. We needed to patch Jersey. Here’s the commit in Payara source code: https://github.com/payara/Payara/pull/2800/files#diff-1a0ff1b907622b750405cad68426242dR262 (the fix is in the patched Jersey version 2.27.payara-p5). The patched version of Jersey is here, but it’s bit of a mess: https://github.com/payara/Payara_PatchedProjects/pull/161/files
Let’s close this issue, @andymc12.
@Jamsek-m, feel free to discuss this on the Jersey mailing list or on Payara Forum