The Spring Vault Oracle App sample demonstrates dynamically loading secrets from OCI Vault into the Spring Boot context during startup. All secrets loaded this way are made available by name as application properties, accessible using @Value
annotations.
- Access to an OCI Account. You can use Free Tier.
- Java 21+, Maven
- OCI Config file for authentication
-
Create an OCI Vault, and add two secrets to the vault named
s1
ands2
. -
Set the following environment variables, using values for your OCI Compartment, Region, and Vault.
OCI_COMPARTMENT_ID=<OCI Compartment ID>
OCI_REGION=<OCI Region>
OCI_VAULT_ID=<OCI Vault OCID>
Using Maven, start the app:
mvn spring-boot:run
Now, query the app to see if the Vault secrets were successfully loaded:
curl localhost:9001/values