我使用的是micronaut框架,我正在尝试从 application.yml
对于标准测试用例,我可以配置datastax驱动程序
cassandra:
default:
clusterName: "Test Cluster"
contactPoint: "192.168.99.100"
port: 9042
maxSchemaAgreementWaitSeconds: 20
ssl: false
但是,我找不到一种方法来提供与该方法一起使用的配置 .withCredentials
我看到了https://github.com/micronaut-projects/micronaut-core/blob/dc8c423be1979817c9c8f53440f3b87e775523b2/configurations/cassandra/src/main/java/io/micronaut/configuration/cassandra/cassandraconfiguration.java
执行以下操作
@ConfigurationBuilder(allowZeroArgs = true, prefixes = { "with", "add" })
Cluster.Builder builder = Cluster.builder();
然而 withCredentials
方法需要2个参数https://docs.datastax.com/en/drivers/java/2.0/com/datastax/driver/core/cluster.builder.html#withcredentials-java.lang.string-java.lang.string-
public Cluster.Builder withCredentials(String username,
String password)
yaml如何为这个方法提供配置?
1条答案
按热度按时间30byixjq1#
新功能由@graeme rocher在https://github.com/micronaut-projects/micronaut-core/issues/1106 我能做到如下: