Spring has a dedicated module, called Spring Cloud Vault, that makes use of Vault in your application a breeze. Spring Cloud Vault is very easy to use, and we will be covering how to use it in this section.
Spring Cloud Vault Config (http://cloud.spring.io/spring-cloud-vault/) provides client-side support for externalized configuration in a distributed system. With HashiCorp's Vault you have a central place to manage external secret properties for applications across all environments. Vault can manage static and dynamic secrets such as username/password for remote applications/resources and provide credentials for external services such as MySQL, PostgreSQL, Apache Cassandra, MongoDB, Consul, AWS, and more.
We will be using the Spring Boot project (generated using Spring Initializr, https://start.spring.io). At the start of the application, Vault is started and all the secrets are picked up:
Unzip the downloaded Spring Initializr project by executing the following command:
unzip -a spring-boot-spring-cloud-vault.zip
Import the project in your favorite IDE (I am using IntelliJ).