I am working with Spring boot 1.1.8, which uses Spring 4.0.7. I automatically create properties in my classes using the @Value annotation. I want to have a default value if the property is not in the properties file, so I use ":" to assign the default value. The following is an example:
@Value("${custom.data.export:false}") private boolean exportData = true;
It should assign false to the variable if the property is not in the properties file that it does. However, an if property is present in the file, then it assigns a default value and ignores the value of the property. For instance. if I defined a property similar to the one mentioned above and the application properties file has something like this custom.data.export=true , then the value of exportData will still be false, whereas it should be true ideally.
Can someone explain to me what I'm doing wrong here?
thanks
source share