title: Spring Cloud Vault with Spring Boot 2.4+ config not working as expected
body: <p>I have a Spring Boot project that gets properties and passwords from vault. In Spring Boot 2.4 and later, the team has decided to change way to load config files. Now we need to use Spring Config Data to load this.</p>
  <p>After reading through docs and examples I setup <a href="https://github.com/pavankjadda/ProfileTest" rel="nofollow noreferrer">sample project</a>. Here I am defining vault details on <code>application.yml</code> by following <a href="https://github.com/spring-cloud/spring-cloud-vault#client-side-usage" rel="nofollow noreferrer">official example</a>.  And defined environment specific files in <code>dev.yml</code> and <code>prod.yml</code>, which contain environment specific properties and files.</p>
  <p><a href="https://github.com/pavankjadda/ProfileTest" rel="nofollow noreferrer">Github Example</a></p>
  <p><strong>application.yml</strong></p>
  <pre><code>server:
    port: 8081
  spring:
    application:
      name: pres
  
    cloud:
      vault:
        authentication: TOKEN
        uri: ${VAULT_URL}
        connection-timeout: 5000
        read-timeout: 15000
        kv:
          enabled: true
          backend: secret
          application-name: app/pres
        token: ${TOKEN}
    config:
      import: vault://secret/app/pres
  
  
  ---
  spring:
    config:
      activate:
        on-profile: &quot;dev&quot;
      import: dev.yml
  ---
  spring:
    config:
      activate:
        on-profile: &quot;prod&quot;
      import: prod.yml
  
  
  
  </code></pre>
  <p><strong>dev.yml</strong></p>
  <pre><code>spring:
    datasource:
      url: &quot;jdbc:mysql://localhost/dev&quot;
      username: &quot;dev&quot;
      password: &quot;dev&quot;
  
  #### ELK Logging
  elk:
    logging:
      rabbitmq:
        hostname: ${pres.elk.logging.rabbitmq.hostname}
        port: 5672
        username: ${pres.elk.logging.rabbitmq.username}
        password: ${pres.elk.logging.rabbitmq.password}
        projectVersion: '@project.version@'
  
  </code></pre>
  <p><strong>prod.yml</strong></p>
  <pre><code>spring:
    datasource:
      url: &quot;jdbc:mysql://localhost:3306/prod&quot;
      username: &quot;prod&quot;
      password: &quot;prod&quot;
  
  #### ELK Logging
  elk:
    logging:
      rabbitmq:
        hostname: ${pres.elk.logging.rabbitmq.hostname}
        port: 5672
        username: ${pres.elk.logging.rabbitmq.username}
        password: ${pres.elk.logging.rabbitmq.password}
        projectVersion: '@project.version@'
  
  </code></pre>
  <p>So when I start the application, Spring Boot supposed to replace placeholders with actual values from vault. However I just see place holders as below</p>
  <pre><code>
  
    .   ____          _            __ _ _
   /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
  ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
   \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
    '  |____| .__|_| |_|_| |_\__, | / / / /
   =========|_|==============|___/=/_/_/_/
   :: Spring Boot ::                (v2.5.2)
  
  2021-06-26 12:14:03.546  INFO 69016 --- [  restartedMain] c.e.profiletest.ProfileTestApplication   : Starting ProfileTestApplication using Java 16.0.1 on pjmacbookpro with PID 69016 (/Users/pjadda/IdeaProjects/ProfileTest/target/classes started by pjadda in /Users/pjadda/IdeaProjects/ProfileTest)
  2021-06-26 12:14:03.548  INFO 69016 --- [  restartedMain] c.e.profiletest.ProfileTestApplication   : The following profiles are active: dev
  2021-06-26 12:14:03.593  INFO 69016 --- [  restartedMain] o.s.v.c.e.LeaseAwareVaultPropertySource  : Vault location [secret/app/pres] not resolvable: Not found
  2021-06-26 12:14:03.594  INFO 69016 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
  2021-06-26 12:14:03.594  INFO 69016 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
  2021-06-26 12:14:04.176  INFO 69016 --- [  restartedMain] o.s.cloud.context.scope.GenericScope     : BeanFactory id=6bdb5f01-aa31-3158-8281-edfa1a02ac83
  2021-06-26 12:14:04.603  INFO 69016 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8081 (http)
  2021-06-26 12:14:04.615  INFO 69016 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
  2021-06-26 12:14:04.615  INFO 69016 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.48]
  2021-06-26 12:14:04.680  INFO 69016 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
  2021-06-26 12:14:04.680  INFO 69016 --- [  restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1085 ms
  2021-06-26 12:14:05.032  INFO 69016 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
  2021-06-26 12:14:05.121  INFO 69016 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8081 (http) with context path ''
  2021-06-26 12:14:05.135  INFO 69016 --- [  restartedMain] c.e.profiletest.ProfileTestApplication   : Started ProfileTestApplication in 2.79 seconds (JVM running for 3.622)
  2021-06-26 12:14:05.465  INFO 69016 --- [nio-8081-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
  2021-06-26 12:14:05.465  INFO 69016 --- [nio-8081-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
  2021-06-26 12:14:05.466  INFO 69016 --- [nio-8081-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 1 ms
  username:${pres.elk.logging.rabbitmq.username}
  password:${pres.elk.logging.rabbitmq.password}
  </code></pre>