How to do it...

  1. Let's continue our experiments by setting the my.config.value configuration property. Build the application by running ./gradlew clean bootJar and start it by running java -Dmy.config.value="From System Config" -jar ./build/libs/bookpub-0.0.1-SNAPSHOT-exec.jar so as to see the following in the logs:
2017-12-17 --- ication$$EnhancerBySpringCGLIB$$b123df6a : Value of my.config.value property is: From System Config
  
  1. If we want to be able to set the Java system property while running our application using the Gradle's bootRun task, we will need to add this to the applicationDefaultJvmArgs configuration in the build.gradle file. Let's add -Dmy.config.value=Gradle to this list and start the application by running ./gradlew clean bootRun. We should see the following in the logs:
2017-12-17 --- ication$$EnhancerBySpringCGLIB$$b123df6a : Value of my.config.value property is: Gradle
  
  1. As we made the applicationDefaultJvmArgs setting to be shared with launch.script, rebuilding the application by running ./gradlew clean bootJar and starting it by running ./build/libs/bookpub-0.0.1-SNAPSHOT-exec.jar should yield the same output in the logs as in the preceding step.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.218.147