Using @Value for a nonexistent environment variable will raise an IllegalArgumentException: the placeholder 'ENV_VAR' could not be resolved to the string value "$ {ENV_VAR}".
For example:
@Autowired
public SomeClass(@Value("{ENV_VAR}") final String value) { }
How to do this optional?
source
share