Let's say we have an environment variable exported as:
export SOME_STRING_CONFIG_PARAM="01"
and application.propertieswith:
some.string.config.param=${SOME_STRING_CONFIG_PARAM:01}
entered in the Java field:
@Value("${some.string.config.param}")
String someStringConfigfParam;
After loading the Spring application, print the field:
System.out.println("someStringConfigParam: " + someStringConfigParam);
result:
someStringConfigParam: 1
How to tell Spring that the value should be treated as a string?
source
share