O'Reilly logo

Java 9 Cookbook by Nick Samoylov, Mohamed Sanaulla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works...

There are multiple ways Spring Boot can read the configuration for the application. Some significant ones are listed here in the order of their relevance (the property defined in the earlier source overrides the property defined in the later sources):

  • From the command line. The properties are specified using the -D option, like we did while launching the app in the cloud profile, mvn spring-boot:run -Dspring.profiles.active=cloud. Or, if you are using JAR, then it would be java -Dspring.profiles.active=cloud -jar myappjar.jar.
  • From the Java system properties, using System.getProperties().
  • OS Environment variables.
  • Profile-specific application properties, application-{profile}.properties, or the application-{profile}.yml

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required