I have a property in a configuration file like:
@Value("${MAX_VALUE:#{100}}")
private int maxSize;
In a properties file I have:
MAX_VALUE=
I'm using Java configurations
@Bean
public EncryptablePropertyPlaceholderConfigurer defaultProperties() {
final EncryptablePropertyPlaceholderConfigurer defaultProperties = new EncryptablePropertyPlaceholderConfigurer(
textEncryptor());
Resource[] resources = new ClassPathResource[] { new ClassPathResource(jobProperties)};
defaultProperties.setLocations(resources);
defaultProperties.setIgnoreUnresolvablePlaceholders(true);
defaultProperties.setIgnoreResourceNotFound(true);
defaultProperties.setSearchSystemEnvironment(true);
return defaultProperties;
}
When the MAX_VALUE parameter is not set I would like it to use the default value. Currently it gives me a 'NumberFormatException: For input string: "" '
Is there anyway to accomplish this or would I have to remove the MAX_VALUE from the properties file to use the default?