Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I override properties in Quarkus?

I would like to override the properties I have configured in my configuration file in my Quarkus application.

How can I accomplish that?

like image 281
geoand Avatar asked Mar 07 '19 12:03

geoand


People also ask

How do I override application properties in spring boot?

To override your Spring Boot application properties when it's running on Kubernetes, just set environment variables on the container. To set an environment variable on a container, first, initialise a ConfigMap containing the environment variables that you want to override.

Which Quarkus feature can you use to define configurations for different environments?

Quarkus uses MicroProfile Config annotations to inject the configuration properties in the application. You can use @Inject @ConfigProperty or just @ConfigProperty .

Is Quarkus overridable at runtime?

The overridability of the former depends on the configuration in question. For example, the http properties (like quarkus.http.port) are overridable. The later are always overridable at runtime. When running a Quarkus application in JVM mode you can, for example, do:

What is the Quarkus-VertX-http configuration property?

This is a user-defined configuration property. This is a configuration property consumed by the quarkus-vertx-http extension. It works in the exact same way as Quarkus Application configuration file application.properties. Recommendation is to use Quarkus application.properties . 1.6.

Where can I find the resources properties in Quarkus?

Properties in Quarkus are generally configured in src/main/resources/application.properties. This is true both for properties that configure the behavior of Quarkus (like the http port it listens to or the database URL to connect to for example) and properties that are specific to your application (for example a greeting.message property).

How do I change the property value of a Quarkus profile?

By default, Quarkus has three profiles: dev– Activated when in development mode (i.e. quarkus:dev) test– Activated when running tests prod– The default profile when not running in development or test mode 2.2 The Quarkus supports the following syntax to change the property value based on profiles. %{profile}.config.key=value For example:


1 Answers

Properties in Quarkus are generally configured in src/main/resources/application.properties.

This is true both for properties that configure the behavior of Quarkus (like the http port it listens to or the database URL to connect to for example) and properties that are specific to your application (for example a greeting.message property).

The overridability of the former depends on the configuration in question. For example, the http properties (like quarkus.http.port) are overridable.

The later are always overridable at runtime.

When running a Quarkus application in JVM mode you can, for example, do:

java -Dgreeting.message=hi -jar example-runner.java

Similarly, when running a Quarkus application that has been converted to a native binary using the GraalVM (specifically the SubstrateVM system), you could do:

./example-runner -Dgreeting.message=hi

More information can be found on the "Quarkus - Configuring Your Application" official guide

like image 134
geoand Avatar answered Oct 05 '22 06:10

geoand