Skip to content
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 exclude JAX-RS classes with annotations #15214

Closed
essobedo opened this issue Feb 20, 2021 · 2 comments · Fixed by #15215
Closed

Allow to exclude JAX-RS classes with annotations #15214

essobedo opened this issue Feb 20, 2021 · 2 comments · Fixed by #15215
Labels
Milestone

Comments

@essobedo
Copy link
Contributor

essobedo commented Feb 20, 2021

Description

The idea of this feature is to provide an easy way to include/exclude JAX-RS resource, provider and feature classes at build time.

So far, the only way to keep control over the JAX-RS resource, provider and feature classes that we will have in our application is to rely on a JAX-RS Application class but it is not really convenient as soon as we have a lot of classes in our project and we want to keep JAX-RS classes for different applications within the same project.

It would be nice if we could have a way to easily exclude JAX-RS classes at build time using annotations like build time conditions

Implementation ideas

The idea could be to allow to annotate JAX-RS classes with build time conditions in order to include them at build time only if the conditions are met, like in the following example:

@IfBuildProfile("app1")
public class ResourceForApp1Only {

    @GET
    @Path("sayHello")
    public String sayHello() {
        return "hello";
     }
}
@essobedo
Copy link
Contributor Author

essobedo commented Feb 20, 2021

Here is a potential fix for it #15215

@Legion2
Copy link

Legion2 commented Feb 22, 2021

Another use case for this is to provide a utility endpoint for the dev mode.

For example when working with reactive messaging, you can replace an incoming channel with a REST endpoint. The developer can then POST messages to the channel using the swagger ui, instead of locally deploying a complex messaging middleware for just passing messages into the application.

@Path("dev")
@ApplicationScoped
@IfBuildProfile("dev")
class DevQueues {

    @Inject
    lateinit var mapper: ObjectMapper

    @Inject
    @Channel("test")
    lateinit var emitter: Emitter<String>

    @POST
    @Path("queue/test")
    fun create(message: DataModel): CompletionStage<Void> {
        return emitter.send(mapper.writeValueAsString(message))
    }
}

@quarkus-bot quarkus-bot bot added this to the 1.13 - master milestone Feb 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants