We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Description Assuming the following config object:
@ConfigProperties(prefix = "greeting") public class MyConfig { public String url; public String host; }
and src/main/resources/application.yaml;
src/main/resources/application.yaml
greeting: url: http://${greeting.host} host: myhost
Then the following test will pass:
@QuarkusTest public class MyTestCase { @Inject MyConfig config; @Test public void test() { Assertions.assertEquals("http://myhost", config.url); } }
However, if I move host=myhost as a default value, the test won't pass anymore:
host=myhost
greeting: url: http://${greeting.host} # host: myhost
and:
@ConfigProperties(prefix = "greeting") public class MyConfig { public String url; @ConfigProperty(defaultValue = "myhost") public String host; }
then I get the following error at startup:
Caused by: java.util.NoSuchElementException: SRCFG00011: Could not expand value greeting.host in property greeting.url
it is the same behavior if I put the default as the field init: public String host="myhost";
public String host="myhost";
I believe that defaults should be picked up in the code, and applied as if the values were present in the src/main/resources/application.yaml.
The text was updated successfully, but these errors were encountered:
Related with eclipse/microprofile-config#475
Sorry, something went wrong.
This can be achieved with @ConfigMapping. Check here: smallrye/smallrye-config@8f40839.
@ConfigMapping
Quarkus @ConfigProperties is now deprecated, so our recommendation is to use @ConfigMapping.
@ConfigProperties
No branches or pull requests
Description
Assuming the following config object:
and
src/main/resources/application.yaml
;Then the following test will pass:
However, if I move
host=myhost
as a default value, the test won't pass anymore:and:
then I get the following error at startup:
it is the same behavior if I put the default as the field init:
public String host="myhost";
I believe that defaults should be picked up in the code, and applied as if the values were present in the
src/main/resources/application.yaml
.The text was updated successfully, but these errors were encountered: