I'm trying to read an environment variable in my Quarkus application using @ConfigProperty
, but didn't manage to do that. I thought that just specifying variable name should be enough, but it isn't working:
@ConfigProperty(name = "MY_ENV_VAR")
String envVar;
I've also tried to specify a property in application.properties
my.var=${MY_ENV_VAR:defaultValue}
and read it like
@ConfigProperty(name = "my.var")
String myVar;
but the variable is always null.
Did I miss something? What is the correct way to read an environment variable in Quarkus?
I'm using Quarkus 1.2.0.Final