【问题标题】:How to set args using Spring Camel Lib in application.properties如何在 application.properties 中使用 Spring Camel Lib 设置参数
【发布时间】:2022-09-27 16:09:24
【问题描述】:

使用 SpringBoot、Java 11。

在 application.properties 我想配置:camel.component.rabbitmq.args

骆驼使用rabbitmq的文档:https://camel.apache.org/components/3.18.x/rabbitmq-component.html#_message_body

注意:我不是在问兔子,只是在应用程序中的配置。

我收到尝试以我的方式配置的错误:

application.properties
camel.component.rabbitmq.args={arg.queue.x-message-ttl=3600000}

错误:

Failed to bind properties under \'camel.component.rabbitmq.args\' to java.util.Map<java.lang.String, java.lang.Object>:

    Reason: No converter found capable of converting from type [java.lang.String] to type [java.util.Map<java.lang.String, java.lang.Object>]

正确的方法是如何举例?谢谢!!!

    标签: spring-boot apache-camel spring-camel


    【解决方案1】:

    在application.properties 中,Map 类型的组件选项的正确语法是componentOptionName[mapKey]=mapValue,所以在你的情况下它是:

    camel.component.rabbitmq.args[queue.x-message-ttl]=3600000
    

    【讨论】:

      猜你喜欢
      • 2013-09-08
      • 1970-01-01
      • 2019-02-12
      • 1970-01-01
      • 2016-08-28
      • 2019-09-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多