I started a Hashicorp Vault and my secrets can be found at secret/demo-app/keycloak
. I have 2 values here: clientId
, clientSecret
I setup the bootstrap.properties
:
spring.application.name=demo-app
spring.cloud.vault.token=00000000-0000-0000-0000-000000000000
spring.cloud.vault.scheme=http
spring.cloud.vault.kv.enabled=true
But I did not find a way to make some @Data
and @Configuration
classes that can read these values at startup using @ConfigurableProperties
:
@Data
@Configuration
@ConfigurationProperties("keycloak")
public class Client {
private String clientId;
private String clientSecret;
@PostConstruct
public void init() {
System.out.println("PostConstruct: " + this.toString());
}
}
But does not seem to work:
PostConstruct: Client(clientId=null, clientSecret=null)
Any ideas what did I miss? Thanks in advance.