Quarkus: How to change the application port?
Quarkus exposes any HTTP application on port 8080
unless we provide an explicit configuration.
How to change the server HTTP port?
To override the default 8080
port, you can set the quarkus.http.port
property in your application properties file usually located at src/main/resources/application.properties
.
quarkus.http.port=8082
Or if you are using YAML
application configuration (src/main/resources/application.yaml
):
quarkus:
http:
port: 8082
How to change the server HTTP port for a specific profile?
You can also set the Quarkus HTTP port for a specific profile (e.g. dev).
If you are using application.properties
, then you have to prefix the property name with %
followed by the profile name (%{profile.name}.property.name
).
You can read more about profiles in Quarkus Configuration Reference: Profiles.
%dev.quarkus.http.port=8082
Or if you are using YAML
application configuration:
"%dev":
quarkus:
http:
port: 8082
How to change the server HTTP port at runtime?
You can also override the build time preconfigured server port at runtime by providing the quarkus.http.port
property in your runtime System properties.
java -Dquarkus.http.port=8082 target/quarkus-app/quarkus-run.jar
Or if you are packaging your application in Native mode:
./target/artifact-1.0.0-SNAPSHOT-runner -Dquarkus.http.port=8082