I am using spring boot configuration properties with an optional property:
@ConfigurationProperties("my.properties")
public class MyProperties {
List<String> optional = new ArrayList(); // optional property
// getters/setters
}
I want my application to fail during startup when there is a property defined in my application.yml which is NOT defined in my properties class, since this might be caused by a typo and therefore to prevent mistakes when configuring applications. e.g:
my:
properties:
optional2:
- foo
- bar
Is this possible, for example by setting a flag?