The following does not work. But how could I then define optional application.properties
?
@Value("${my.property}")
private Optional<String> property;
The following does not work. But how could I then define optional application.properties
?
@Value("${my.property}")
private Optional<String> property;
From How to define @Value as optional , you can define a property's default value as null:
@Value("${myValue:#{null}}")