- In the previous recipe, we added a configuration property named my.config.value. Let's build the application by running ./gradlew clean bootJar and start it by running MY_CONFIG_VALUE="From ENV Config" ./build/libs/bookpub-0.0.1-SNAPSHOT-exec.jar --spring.profiles.active=logger so as to see the following output in the logs:
2017-12-17 --- ication$$EnhancerBySpringCGLIB$$b123df6a : Value of my.config.value property is: From ENV Config
- If we want to use the environment variables while running our application via the Gradle bootRun task, the command line will be MY_CONFIG_VALUE="From ENV Config" ./gradlew clean bootRun and should produce the same output as in the preceding step.
- Conveniently enough, we can even mix and match ...