Skip to content

Annotation DefaultValue cannot use values from application.properties #413

Open
@R4V3NN0

Description

@R4V3NN0

Description

The annotation @DefaultValue can't use any properties from the application.properties, it does not resolve them. I tried it with different ObjectTypes e.g. String Integer int long Longand always it says something like "Character $ is neither a decimal digit number, decimal point, nor "e" notation exponential mark." When Im using e.g. u instead of $ at the start of the value then it says the same but with u instead of $.
As for as I have researched it, it seems that the value in @DefaultValue is parsed to an double, which is not possible and the property does not get resolved.

Example Code

application.properties
proxy.graphql.limit-default=100

Code from Resolver

	public Collection<Object> limitedFunction(@Name("limit") @DefaultValue("${proxy.graphql.limit-default}") final Integer limit) {
		//Some more code
		return List.of();
	}

Expected behavior

The value from the property should be read and it should be set in the parameter limit.

Actual behavior

The value is not read and limit is null

How to Reproduce?

Can be reproduced with the example code

Environment

Output of java -version

java 17.0.1 2021-10-19 LTS
Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)

Build tool output of `mvn -v

Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: D:\apache-maven-3.8.1\bin..
Java version: 17.0.1, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-17.0.1
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions