Using application.yml as the interface to Docker
Modern containerised 12 factor applications are expected to derive their configuration from environment variables. While Spring Boot does import some of its properties from environment variables, it doesn’t for most of its common properties.
This post is part of the “Spring Boot Primer” series.
To avoid littering your code with environment variable names, and allow you to configure the common Spring Boot properties it’s simply a matter of using variable interpolation in your
To allow you to set sensible defaults, so that your application can be started straight from your IDE with no additional configuration, you can also embed your development environment defaults, with the normal BASH-style syntax:
At development-time (either running the app locally in your IDE / CLI or in Docker), you don’t need to provide any additional configuration; making set-up for new developers on your team very rapid.
At production-time, all of these properties can easily be set via your
or (even better) pull out into a secure key store such as LastPass.