Created
July 26, 2020 20:23
-
-
Save rajeevshukla/ecb269d6e8cfaef7e3260090b9fb23c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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