What is the priority order of configuring files in Spring Boot?
The priority order of Spring Boot configuration files is as follows:
- The external property file specified by the @PropertySource annotation on the SpringApplication class has the highest priority.
- configuration/
- Configuration folder
- active profiles for spring applications
- properties file for the application’s profile
- configuration file for a specific profile- application-{profile}.yml
- active profiles in spring
- properties file for an application
- settings file in YAML format
- @TestConfiguration can be paraphrased as “Configuration for testing.”
- Using the @TestPropertySource tag
Note: Properties used in the configuration file can be injected into other components of the application using the @Value annotation.