This example shows how to load configuration from multiple configuration sources using profiles.
This example contains the following profiles:
- no profile - if you start the application with no profile, the usual
src/main/resources/application.yamlwill be used local-src/main/resources/application-local.yamlwill be useddev- has an explicit profile fileconfig-profile-dev.yamlon classpath that defines an inlined configurationstage- has an explicit profile fileconfig-profile-stage.yamlon classpath that defines a classpath config sourceprod- has an explicit profile fileconfig-profile-prod.yamlon file system that defines a path config source
To switch profiles
- either use a system property
config.profile - or use an environment variable
HELIDON_CONFIG_PROFILE
Build the application
mvn clean packageRun it with a profile
java -Dconfig.profile=prod -jar target/helidon-examples-config-profiles.jarChanging the profile name should use different configuration.