quarkus.application.version config property is unavailable

Created on 18 Dec 2019  路  10Comments  路  Source: quarkusio/quarkus

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:

  1. Create a sample project and add the endpoint above

Configuration

# Add your application.properties here, if applicable.

areconfig kinbug

All 10 comments

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!

Was this page helpful?
0 / 5 - 0 ratings