Skip to content

Instantly share code, notes, and snippets.

@rajeevshukla
Created July 26, 2020 20:23
Show Gist options
  • Save rajeevshukla/ecb269d6e8cfaef7e3260090b9fb23c4 to your computer and use it in GitHub Desktop.
Save rajeevshukla/ecb269d6e8cfaef7e3260090b9fb23c4 to your computer and use it in GitHub Desktop.
@SpringBootApplication
public class SpringCloudVaultIntegrationApplication implements CommandLineRunner {
// Reading through yml file
@Value("${app.security.key}")
private String appSecurityKey;
// Accessing same key what we added in vault and accessing that directly in @Value()
@Value("${appSecurityKey}")
private String secretKeyVaultDirectAccess;
public static void main(String[] args) {
SpringApplication.run(SpringCloudVaultIntegrationApplication.class, args);
}
@Override
public void run(String... args) throws Exception {
System.out.println("Password fetched from vault:" + appSecurityKey);
System.out.println("Accessing vault key directly :" + secretKeyVaultDirectAccess);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment