Problem: To allow null in @value or to set null as default in Spring @value annotation if the property does not exist.
Solution: after property include :#{null}
Example:
// Non null allowed value
@Value("${property.value}")
String propertyName
// Nullable and null as default value
@Value("${property.value:#{null}}")
String propertyName
Explanation: Here we are using Spring Expression Language (SpEL) to set null as default value if does not exist in properties.
Source:
For more interesting tutorials & guides just check them HERE.