jmzhang18
jmzhang18

Reputation: 141

Spring Boot Google Cloud Secret Manager

I followed the instruction on setting secret manager with GCP on Spring Boot, I created a secret in Google Cloud, and added the following in application.properties

spring.datasource.password=${sm://DB_PASSWORD}

It didn't work, however, if I used SecretManagerTemplate, I can get the secret by secretManagerTemplate.getSecretString("DB_PASSWORD");

However, I need the datasource password to be initialized at the beginning of the application, has anyone used secret manager in spring boot?

Upvotes: 0

Views: 2428

Answers (1)

jmzhang18
jmzhang18

Reputation: 141

The problem can be solved magically by changing pom.xml from

    <properties>
        <spring-cloud.version>Hoxton.SR4</spring-cloud.version>
    </properties>

to

    <properties>
        <spring-cloud.version>Hoxton.SR6</spring-cloud.version>
    </properties>

Upvotes: 1

Related Questions