Spring Boot 在应用程序.yml中找到重复的键

hlswsv35  于 2022-12-13  发布在  Spring
关注(0)|答案(1)|浏览(350)

我一直在一个Kafka流项目上工作我是新的yaml文件我一直在使用application.properties.基本上我想使用Kafka属性以及springfox属性这里是我的
application.yml

spring:
  cloud:
    function:
      definition: consumer;producer
    stream:
      kafka:
        bindings:
          producer-out-0:
            producer:
              configuration:
                value.serializer: <packagename>

          consumer-in-0:
            consumer:
              configuration:
                value.deserializer: <packagename>
        binder:
          brokers: localhost:9092   
      bindings:
        producer-out-0:
          destination: <topic name>
          producer:
            useNativeEncoding: true # Enables using the custom serializer
        consumer-in-0:
          destination: <topic name>
          consumer:
            use-native-decoding: true # Enables using the custom deserializer 
spring:
  mvc:
    pathmatch:
      matching-strategy: ANT_PATH_MATCHER

它显示

in 'reader', line 1, column 1:
    spring:
    ^
found duplicate key spring
 in 'reader', line 31, column 1:
    spring:
    ^

我试着添加mvc:在这之间和其他事情似乎没有工作,我不知道如何获得Spring键作为父MVC:路径匹配:不破坏上述配置

flmtquvp

flmtquvp1#

spring是一个重复项!您的YAML应该如下所示:

spring:
  cloud:
    function:
      definition: consumer;producer
    stream:
      kafka:
        bindings:
          producer-out-0:
            producer:
              configuration:
                value.serializer: <packagename>

          consumer-in-0:
            consumer:
              configuration:
                value.deserializer: <packagename>
        binder:
          brokers: localhost:9092   
      bindings:
        producer-out-0:
          destination: <topic name>
          producer:
            useNativeEncoding: true # Enables using the custom serializer
        consumer-in-0:
          destination: <topic name>
          consumer:
            use-native-decoding: true # Enables using the custom deserializer 
  mvc:
    pathmatch:
      matching-strategy: ANT_PATH_MATCHER

相关问题