Skip to content

Instantly share code, notes, and snippets.

@skuppa
Last active August 29, 2015 14:16
Show Gist options
  • Save skuppa/ce3298e99828293d4d22 to your computer and use it in GitHub Desktop.
Save skuppa/ce3298e99828293d4d22 to your computer and use it in GitHub Desktop.
Spring Boot Hints

Spring boot property loading order

Spring Boot looks for properties using a specific order:

  1. Command line arguments
  2. Java System properties (System.getProperties())
  3. OS environment variables
  4. JNDI attributes from java:comp/env
  5. A RandomValuePropertySource that only has properties in random.*
  6. Application properties outside of your packaged jar (application.properties including YAML and profile variants)
  7. Application properties packaged inside your jar (application.properties including YAML and profile variants)
  8. @PropertySource annotations on your @Configuration classes
  9. Default properties (specified using SpringApplication.setDefaultProperties)

Reference: http://stackoverflow.com/questions/26129548/how-to-configure-default-application-properties-via-e-g-custom-starter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment