This question might not be appropriate to ask here, but I have tried various methods and still can't solve the problem.
Using com.orbitz.consul.consul-client:1.5.3, I can retrieve the value of the key from Consul's KV store in code. However, configuring it with Spring Boot 3.2.2 fails.
I have set up a Consul cluster with three nodes, all running in server mode. TLS is enabled for both outgoing and incoming connections, and ACL is also enabled. I used the same CA to issue p12-format certificates for accessing the Consul cluster.
I created a value with the key config/example-spring,dev/data in Consul's KV store and generated an ACL token with the necessary permissions to access this key.
The crucial part of the code is as follows:
#load the p12 file from the file system and trust any certificate.
SSLContext sslContext = createSSLContext("/path/to/user1.p12", "key-password");
Consul consul = Consul.builder().withAclToken("58f89672-c9a1-8a97-0d0c-cd2a32fb8f36")
.withUrl("https://c3.consul.casa:8501")
.withHostnameVerifier(new HostnameVerifier() {
@Override
public boolean verify(String hostname, SSLSession session) {
return true;
}
})
.withSslContext(sslContext).build();
KeyValueClient kvClient = consul.keyValueClient();
#Successfully retrieved the value
String yaml = kvClient.getValueAsString("config/example-spring,dev/data").get();
In my understanding, the configuration of the Consul cluster is correct.
but the configuration fails with Spring Boot 3.2.2
This question might not be appropriate to ask here, but I have tried various methods and still can't solve the problem.
Using
com.orbitz.consul.consul-client:1.5.3
, I can retrieve the value of the key from Consul's KV store in code. However, configuring it withSpring Boot 3.2.2
fails.I have set up a Consul cluster with three nodes, all running in server mode. TLS is enabled for both outgoing and incoming connections, and ACL is also enabled. I used the same CA to issue p12-format certificates for accessing the Consul cluster.
I created a value with the key config/example-spring,dev/data in Consul's KV store and generated an ACL token with the necessary permissions to access this key.
The crucial part of the code is as follows:
In my understanding, the configuration of the Consul cluster is correct. but the configuration fails with Spring Boot 3.2.2
application.properties:
bootstrap.yml:
error message:
Thanks all.