-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Constructor injection in JAX-RS Resource which implements an interface causes an RuntimeException #10430
Comments
I am pretty sure that the reason this is happening isn't because of the interface, but because of the lombok annotation. |
I got the same exception with the following code, where I removed all annotations. public class MyResource implements MyResourceDoc {
private MyService service;
@Inject
MyResource(final MyService service){
this.service = service;
} |
Can you please upload your code to github so I can try it? I haven't been able to reproduce that error |
If clone the following repo and run "mvn quarkus:dev" you should get the same exception. Thanks a lot fore your time |
Thanks for the reproducer. I added another commit to #10446 that handles your use case |
Stop lombok annotations from preventing no-args ctor generation
Is it supposed to be fixed on 1.6.1.Final? I'm using this version and still having the issue, here a sample |
Explicitly add a NonArg constructor fixes the problem, I expect Quarkus to solve it for me though @Tag(name = "hello-samples")
@Path("/hello")
public class FruitResource {
HelloService helloService;
public FruitResource() {
}
@Inject
public FruitResource(HelloService helloService) {
this.helloService = helloService;
}
.... |
Describe the bug
Constructor injection in an RX-Resource class, which implements an interface raise an RuntimeException.
The Resource class contains methods to handle the requests and the interface contains all openapi annotations.
Expected behavior
Constructor injection also work like the field injection.
Actual behavior
On startup:
Caused by: java.lang.RuntimeException: RESTEASY003190: Could not find constructor for class: xx.xxx.IncidentResource
To Reproduce
Steps to reproduce the behavior:
Interface for api doc
Resource class
The field injection works as expected:
Configuration
The text was updated successfully, but these errors were encountered: