hello,
I have the following code:
@ConfigProperty(name = "bar")
String bar;
with src/main/application.properties
bar=${foo:default-foo}
when I execute: java -jar target\rest-client-quickstart-1.0-SNAPSHOT-runner.jar
I get bar=default-foo, which is expected
when I execute: java -Dfoo=hello -jar target\rest-client-quickstart-1.0-SNAPSHOT-runner.jar
I get bar=hello, which is also expected
but when I execute: java -Dfoo= -jar target\rest-client-quickstart-1.0-SNAPSHOT-runner.jar
I get: javax.enterprise.inject.spi.DeploymentException: No config value of type [java.lang.String] exists for: bar, which I did not expect
if is no value for foo, then I should get 'default-foo'?
it is the same if I had in the code:
@ConfigProperty(name = "foo", defaultValue = "default-foo")
String foo;
and I executed: java -Dfoo= -jar target\rest-client-quickstart-1.0-SNAPSHOT-runner.jar
then I am getting: ERROR [io.qua.run.Application] (main) Failed to start application (with profile prod): java.lang.RuntimeException: Error injecting java.lang.String org.acme.rest.client.CountriesMain.foo
note: I am experimenting those corner cases because I use quarkus to run a tekton task. a task can define input parameters, with an optional default value. this input parameter can be set as a value for an env variable. but I do not have a way to say that an env variable should only be pushed to the container if there is a value. and I would rather define default values in the quarkus app, rather than in tekton. so the only thing I could achieve was to pass an empty env variable, and hope that quarkus would react by ignoring the override. ansd apparently that is not the case.