Skip to content

What is the default scope for REST resource beans (using @Path annotation) ? #44387

Answered by mkouba
omasseau asked this question in Q&A
Discussion options

You must be logged in to vote

Does it mean that the default scope is @ApplicationScoped or @singleton, as both are single instances ?

For quarkus-resteasy (RESTEasy Classic), it's controlled by the quarkus.resteasy.singleton-resources config property and it should be @Singleton by default. For quarkus-rest (RESTEasy Reactive, default rest extension), it's @Singleton by default AFAIK. But maybe there are some exceptions? CC @geoand @FroMage.

Is there any reason to explictitely use one of this scope explicitely ?
Which one is better ?
The documentation says that its better to use @ApplicationScoped : https://quarkus.io/guides/cdi#applicationscoped-and-singleton-look-very-similar-which-one-should-i-choose-for-my-quark…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@geoand
Comment options

Answer selected by omasseau
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants