geoand
geoand

Reputation: 63991

How can I set the base path for my RESTEasy resources in Quarkus?

I would like to set the base path under which all my RESTEasy resources would fall, without having to include a class that extends javax.ws.rs.core.Application.

Basically I would like to get rid of:

import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;

@ApplicationPath("/api")
public class MyApplication extends Application {

}

How can I achieve that?

Upvotes: 7

Views: 8048

Answers (3)

Juanes30
Juanes30

Reputation: 2546

I am using Quarkus 2.13.1 and I made the following configuration. More info.

Modify application.properties file and add the following lines

# Apply this path for the whole application, including metrics, etc.
quarkus.http.root-path=/api/
# In case you want to change a different route
quarkus.http.non-application-root-path=/q

Upvotes: 0

geoand
geoand

Reputation: 63991

Quarkus allows the base path to be configured in application.properties (see here).

So simply replace the class above with the following in application.properties:

quarkus.resteasy.path=/api

UPDATE

When using RESTEasy Reactive, as pointed out by https://stackoverflow.com/a/72426133/2504224, one needs to use:

quarkus.resteasy-reactive.path=/api/

Upvotes: 14

lorefnon
lorefnon

Reputation: 13095

The accepted answer works for quarkus resteasy classic.

If you are using quarkus-resteasy-reactive you will need to set:

quarkus.resteasy-reactive.path=/api/

Upvotes: 7

Related Questions