How can I override properties in Quarkus?

喜欢而已 提交于 2020-08-07 08:14:47

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!