问题
I would like to override the properties I have configured in my configuration file in my Quarkus application.
How can I accomplish that?
回答1:
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
来源:https://stackoverflow.com/questions/55043399/how-can-i-override-properties-in-quarkus