0
votes

I'm new to Quarkus, I wrote an extension that provides a rest API, let's call it /myapi.

@Path("/myapi")
public class MyApi {

  @Inject
  private ServiceInterface someService; //provided by the app that uses the extension

  @POST
  public MyResponse processMessage(MyMessage message) {
    return someService.processMessage(message);
  }

}

The idea is that the extensions would provide the rest resources needed by the application(s) and the application provides the business logic.

So I created a Quarkus project that uses that extension and provides a bean that implements ServiceInterface with the business logic.

But, when I start the app, the endpoint /myapi is not created, and when I call it, it returns a 404.

The question is: how can I make the rest resource defined in the extension visible to the application that uses it?

1

1 Answers

0
votes

I finally came up with this solution:

 @BuildStep
  void addDominoApi(BuildProducer<AdditionalBeanBuildItem> additionalBeans) {
    additionalBeans.produce(AdditionalBeanBuildItem.unremovableOf(MyApi.class));
  }

Adding MyApi to the additional beans