/spring-vault-oracle-app

Example app using OCI Vault to load properties in a Spring App

Primary LanguageJavaApache License 2.0Apache-2.0

spring-vault-oracle-app

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.

Prerequisites

Setup

  1. Create an OCI Vault, and add two secrets to the vault named s1 and s2.

  2. 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>

Run the app

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