spring-cloud / spring-cloud-vault

Configuration Integration with HashiCorp Vault
http://cloud.spring.io/spring-cloud-vault/
Apache License 2.0
270 stars 151 forks source link

Add AOT and Graal Native support #667

Closed kartik-kaushik closed 1 year ago

kartik-kaushik commented 1 year ago

Describe the bug

Vault connection fails to initialize during the Spring Boot 3 AOT phase

Sample Via the Spring Initializer, create any project with:

spring-boot-starter-parent:3.0.1 spring-cloud-starter-vault-config (spring-cloud-dependencies:2022.0.0 is configured automatically)

the application works normally, but when passing through the AOT phase, the build fails with this error:

Exception in thread "main" java.lang.IllegalStateException: No constructor or factory method candidate found for Root bean: class [org.springframework.vault.client.RestTemplateFactory]; scope=singleton; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodNames=null; destroyMethodNames=null and argument types []

vault config in application.yaml

spring: config: import: vault:///app profiles: active: dev12 application: name: app cloud: vault: authentication: APPROLE fail-fast: false uri: https://vaultui app-role: role-id: db02udb8-a390-0239-980e-11ec746f95ab secret-id: 8d9nf101-5764-124d-f5e4-ab98fa9ed2c3 generic: enabled: false

mp911de commented 1 year ago

There's no AOT support for Vault yet.

igcherkaev commented 1 year ago

There's no AOT support for Vault yet.

Is it planned to be added? And if yes, when?

kartik-kaushik commented 1 year ago

@mp911de any tentative date on it. When can we expect it's support

Abhi-Codes commented 1 year ago

@mp911de Any workaround by adding hints until we get the support for AOT?

mp911de commented 1 year ago

We need some infrastructure from Spring Vault, see https://github.com/spring-projects/spring-vault/issues/747

igcherkaev commented 1 year ago

Thank you @mp911de ! This all looks encouraging!

raj-saxena commented 5 months ago

Hi @mp911de, I see that this issue was closed almost and year back and it has been a while since other commits referencing this issue. Does spring-cloud-vault support AOT and Graal Native now? If yes, can you please point me to the docs I couldn't find it here https://cloud.spring.io/spring-cloud-vault/reference/html/?

mp911de commented 5 months ago

What kind of documentation are you looking for? There isn't anything that you could configure in regard to AOT. For a general Spring application using Spring Cloud Vault, you just compile a native image and you're good to go.

raj-saxena commented 5 months ago

You are right @mp911de. I tried it on a quick project - https://github.com/raj-saxena/test-vault-with-graal/tree/main/src/main/java/com/example/testgraal and it worked as expected.

Thanks for the reply!