Developing Java Applications with Spring and Spring Boot
by Claudio Eduardo de Oliveira, Greg L. Turnquist, Alex Antonov
How it works...
You might have already guessed that Java system properties are consumed by a similar mechanism that is used for environment variables, and you would be correct. The only real difference is the implementation of PropertySource. This time, a more generic MapPropertySource implementation is used by StandardEnvironment.
What you have also probably noticed is the need to launch our application using the java -Dmy.config.value="From System Config" -jar ./build/libs/bookpub-0.0.1-SNAPSHOT-exec.jar command instead of just simply invoking the self-executing packaged JAR by itself. This is because, unlike the environment variables and command-line arguments, Java system properties have to be set on the Java executable ahead of everything ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access