spring-cloud-vault icon indicating copy to clipboard operation
spring-cloud-vault copied to clipboard

not working with new versions

Open maciejbak85 opened this issue 2 years ago • 1 comments

Hi,

for a code/repo example I can provide this blog post: https://medium.com/@zeeshanalamkhan/integrating-hashicorp-vault-with-spring-boot-2-x-7a1be1365d8b

I tried to use example from https://docs.spring.io/spring-cloud-vault/docs/current/reference/html/#quick-start but I see it uses 2.4.0.RELASE which does not exists in mvnrepository.

in short it works fine with older versions of spring-boot-starter-parent ie: 2.13.2.RELASE but not for 2.6.4, ( also there is upgrade needed for spring-cloud 2021.0.1 otherwise we have errors: Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata )

but well in short, 2.13.2.RELASE -> 2.6.4 and Hoxton.SR12< -> 2021.0.1, no code, config changes at all, just upgraded libs. And I get nulls instead of real values.

Not sure if its a bug, maybe there is needed some other change in code/config. If you could help me, please.

thanks!

maciejbak85 avatar Mar 20 '22 11:03 maciejbak85

Hi there,

We ran into the same issue. Most of the examples out there were done with releases before 2.4. With 2.4 there was a change regarding properties processing. See https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.4-Release-Notes#config-file-processing-application-properties-and-yaml-files .

We switched to spring.config.import and then it works as expected.

application.yml example

spring:
  cloud:
    vault:
      uri: https://<vault_fqdn>
      authentication: TOKEN
      token: s.XXXX
      fail-fast: true
      kv:
        enabled: true
        backend: <backend-mount-path>
        default-context: <path-to-secret>
  config:
    import: vault://

I just wanted to share this because I suspect you and probably others are struggling with it. I'm not a developer and the solution may not be perfect, but it works.

smirta avatar Apr 02 '22 10:04 smirta