What is the priority order of configuring files in Spring Boot?

The priority order of Spring Boot configuration files is as follows:

  1. The external property file specified by the @PropertySource annotation on the SpringApplication class has the highest priority.
  2. configuration/
  3. Configuration folder
  4. active profiles for spring applications
  5. properties file for the application’s profile
  6. configuration file for a specific profile- application-{profile}.yml
  7. active profiles in spring
  8. properties file for an application
  9. settings file in YAML format
  10. @TestConfiguration can be paraphrased as “Configuration for testing.”
  11. Using the @TestPropertySource tag

Note: Properties used in the configuration file can be injected into other components of the application using the @Value annotation.

bannerAds