Setting a variable with the value of a property from .properties file (note how spring does automatic type conversion to int)
@Value("${some.property}")
private int SOME_PROPERTY;
Use a default property value if the specified property is not present
@Value("#{'${prop.val.specific:${prop.val.default:}}'}")
private String PROP_VALUE;
Setting comma separated values to a List
@Value("#{'${comma.separated.property}'.split(',')}")
private List<String> COMMA_SEPARATED_PROPERTY;
Top comments (0)