Application.yaml:
request.delay.ms: 200
A spring component:
@Value("${request.delay.ms}")
private long requestDelay;
Now, as strange as it sounds, it looks like spring can successfully resolve the property if it's value is a string, i.e. if I change 200
to 200a
. It does throw an error
Caused by: java.lang.NumberFormatException: For input string: "200a"
but that's expected.
If I change the value back to 200
I get
Caused by: org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'long'; nested exception is java.lang.NumberFormatException: For input string: "${request.delay.ms}"
And if I run tomcat in debug mode and step through the spring code, it works fine with no errors.
String @Value(s) are resolved fine in the same component all the time.