【问题标题】:How to config cassandra in application.yml of spring boot?如何在spring boot的application.yml中配置cassandra?
【发布时间】:2018-12-30 15:27:03
【问题描述】:

我在 Spring boot 项目中有“application.properties”文件,其中有 Cassandra 数据源配置:

spring.data.cassandra.keyspace-name=quangkeyspace
spring.data.cassandra.contact-points=localhost
spring.data.cassandra.port=9042
spring.data.cassandra.schema-action=create_if_not_exists

我想尝试改用 application.yml。我怎样才能转换它?例如:

data:    
   cassandra:
       keyspace-name:quangkeyspace
       contact-points:localhost
       port: 9042
       schema-action=create if not exists

在哪里可以找到这些关键字?

【问题讨论】:

    标签: spring spring-boot cassandra yaml


    【解决方案1】:

    您可以在这里找到 commons spring 道具: https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html

    我建议试试这个:

    spring:
      data:
        cassandra:
          keyspaceName: quangkeyspace
          contactPoints: localhost
          port: 9042
          schemaAction: CREATE_IF_NOT_EXISTS
    

    连字符分隔的关键字通常替换为驼峰式语法。

    【讨论】:

      猜你喜欢
      • 2017-05-24
      • 2018-03-24
      • 2018-09-24
      • 1970-01-01
      • 2016-06-07
      • 2019-07-17
      • 2019-05-19
      • 1970-01-01
      • 2022-01-09
      相关资源
      最近更新 更多