If you have not changed the defaults of Spring Boot (meaning you are using @EnableAutoConfiguration
or @SpringBootApplication
and have not changed any Property Source handling), then it will look for properties with the following order (highest overrides lowest):
/config
subdir of the current directory/config
package The list above is mentioned in this part of the documentation
What that means is that if a property is found for example application.properties
under src/resources
is will be overridden by a property with the same name found in application.properties
in the /config
directory that is "next" to the packaged jar.
This default order used by Spring Boot allows for very easy configuration externalization which in turn makes applications easy to configure in multiple environments (dev, staging, production, cloud etc)
To see the whole set of features provided by Spring Boot for property reading (hint: there is a lot more available than reading from application.properties
) check out this part of the documentation.
As one can see from my short description above or from the full documentation, Spring Boot apps are very DevOps friendly!