Google News
logo
Java Spring Boot - Interview Questions
Mention the possible sources of external configuration.
There is no doubt in the fact that Spring Boot allows the developers to run the same application in different environments. Well, this is done with the support it provides for external configuration. It uses environment variables, properties files, command-line arguments, YAML files, and system properties to mention the required configuration properties. Also, the @value annotation is used to gain access to the properties. So, the most possible sources of external configuration are as follows:
 
Application Properties : By default, Spring Boot searches for the application properties file or its YAML file in the current directory, classpath root or config directory to load the properties.
 
Command-line properties : Spring Boot provides command-line arguments and converts these arguments to properties. Then it adds them to the set of environment properties.
 
Profile-specific properties :  These properties are loaded from the application-{profile}.properties file or its YAML file. This file resides in the same location as that of the non-specific property files and the{profile} placeholder refers to an active profile.
Advertisement