I've generated a Spring Boot web application using Spring Initializr, using embedded Tomcat + Thymeleaf template engine.
I put this property in my application.properties
default.to.address=nunito.calzada@gmail.com
I am using Spring Tool Suite Version: 3.8.4.RELEASE as a development environment, but I got this warning in the Editor 'default.to.address' is an unknown property.
Should I put this property in another property file ?
It's because it's being opened by the STS properties editor which validates properties amongst other things. There's no harm in having it in the application.properties file, you can even add your own meta-data for the property.
http://docs.spring.io/spring-boot/docs/current/reference/html/configuration-metadata.html
I was also having the same warnings in application.properties and looking for a way to get rid of this. Searching for an answer has led me here. So I am posting my answer; it may be useful.
There is no harm in using your custom properties in application.properties. There are two ways to get rid of this -
As mentioned in one of the answers, you can add the meta-data for the custom properties (manually or using quick-fix in STS).
If you don't want to add meta-data, then in STS, go to Window -> preferences -> spring -> boot -> properties editor. Here, select 'unknown property' as ignore. By default, it is warning.
I use this method to add properties in the file application.properties.
Add your new property in application.properties :
default.to.address=nunito.calzada@gmail.com
Hover the new property, you'll see a "quickfixes tooltip" which proposes you to add the new property: Create metadata for 'default.to.address'.
Then, browse the class and field you want to bind the property to and add this annotation:
@Value("${default.to.address}")
private String address;
Now your object field should be valued with the property value.
You should try adding these kind of values in Environment, instead application.properties, since you have the option to update the values anytime without doing compile changes / redeploy changes. application.properties could more beneficial for the properties that you never change like database credentials.
You need to use spring-boot-configuration-processor
which will generate the configuration metadata for you.
See the example: https://www.baeldung.com/spring-boot-configuration-metadata