简体   繁体   中英

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?

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM