-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Allow to register JAX-RS endpoints generated by extensions #36151
Comments
Can you elaborate a little more on this please? |
I created a very simple extension to expose one JAX-RS enpoint package com.dyutiman.rest.extension.runtime;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
@Path("/dummy")
public class DummyResource {
@GET
public String get() {
return "My resource called";
}
} And I have used 'quarkus-resteasy' artifactId in my pom.xml under runtime and 'quarkus-resteasy-deployment' in deployment. I created the BuildStep to include this class. @BuildStep
AdditionalBeanBuildItem resource() {
return new AdditionalBeanBuildItem(DummyResource.class);
} This is exposed perfectly when I use the extension in my project. But, instead of 'quarkus-resteasy' and 'quarkus-resteasy-deployment', if I use 'quarkus-resteasy-reactive' and 'quarkus-resteasy-reactive-deployment' or 'quarkus-resteasy-reactive-jackson' and 'quarkus-resteasy-reactive-jackson-deployment', the endpoint does not work anymore. Do I have to use a different BuildItem for this? |
Try using |
Thanks for the reply. I tried the below BuildStep, but my class is not recognised. @BuildStep
void resource(CombinedIndexBuildItem index,
BuildProducer<AdditionalResourceClassBuildItem> additionalResourceClassProducer) {
DotName path = DotName.createSimple(Path.class.getName());
for (AnnotationInstance restController : index.getIndex().getAnnotations(path)) {
AnnotationTarget annotTarget = restController.target();
System.out.println("got class " + annotTarget);
if(AnnotationTarget.Kind.CLASS.equals(annotTarget.kind())) {
ClassInfo targetClass = restController.target().asClass();
String singlePath = restController.value("value").value().toString();
System.out.println("PATH " + singlePath);
additionalResourceClassProducer.produce(new AdditionalResourceClassBuildItem(targetClass, singlePath));
}
}
} Do I have to make anything for my class to be included in CombinedIndexBuildItem? |
Nope. We use |
Just to confirm my @path class belongs to the runtime module of my extension. I hope this is fine. |
Well, it started working after I added the jandex-maven-plugin to my runtime pom.xml.
Thanks @geoand for your help on AdditionalResourceClassBuildItem! |
👍🏼 |
Description
The JAX-RS resource produced by a Quarkus extension is not registered when using quarkus-resteasy-reactive or quarkus-resteasy-reactive-jackson.
The same is working with just quarkus-resteasy.
Implementation ideas
No response
The text was updated successfully, but these errors were encountered: