Describe the bug
The following config property injection doesn't work:
@Path("/hello")
public class GreetingResource {
@ConfigProperty(name = "quarkus.application.version", defaultValue = "not-set")
String version;
@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
return "hello " + version;
}
}
Expected behavior
When running http localhost:8080/hello, to return hello 1.0.0-SNAPSHOT
Actual behavior
When running http localhost:8080/hello, it returns hello not-set
To Reproduce
Steps to reproduce the behavior:
Configuration
# Add your application.properties here, if applicable.
There is a question about this in: https://stackoverflow.com/questions/58306053/how-can-i-get-the-version-of-the-application-defined-by-tag-version-im-pom-in/59389950#59389950
For the record: quarkus.application.version is supposed to return the application version, not the Quarkus version. We should probably have some sort of API to return the Quarkus version
The values should have been written to the generated class io.quarkus.runtime.generated.BuildTimeRunTimeDefaultValuesConfigSource. The code which does so is here: https://github.com/quarkusio/quarkus/blob/1.1.0.Final/core/deployment/src/main/java/io/quarkus/deployment/configuration/RunTimeConfigurationGenerator.java#L612-L638
@gastaldi Thanks for turning this into an issue. :)
I'm surprised it doesn't work. I'm pretty sure it used to work at some point, together with the quarkus.application.name.
quarkus.application.name also doesn't work, just tested :(
So we also definitely need a test for these two properties :)
I'll take a look but there is a good chance I won't be able to figure it out today since my day is very short
Thank you for fixing this! :) It works with 1.2.0.CR1
Thank for confirming!