【问题标题】:Spring Cloud Data Flow Server application.properties is ignoredSpring Cloud Data Flow Server application.properties 被忽略
【发布时间】:2017-12-25 02:28:39
【问题描述】:

刚刚试用了 Spring Cloud Stream 和 SCDF,看起来很简单(就像 Spring 通常那样)。 然而,偶然发现了一些东西。我有 application.properties 有以下条目。这是一个处理器应用程序。

spring.cloud.stream.bindings.input.destination=work.in
spring.cloud.stream.bindings.input.contentType=text/plain
spring.cloud.stream.bindings.input.binder=rabbit
spring.cloud.stream.bindings.input.group=testgroup
spring.cloud.stream.bindings.output.destination=work.out
spring.cloud.stream.bindings.output.contentType=text/plain
spring.cloud.stream.bindings.output.binder=rabbit
spring.cloud.stream.bindings.output.group=testgroup

当我将它作为一个独立的 jar 运行时(就像另一个 spring boot 应用程序一样),它尊重 application.properties 并且一切都按预期工作。

当我使用 SCDF 创建流时,它会忽略属性并使用约定 stream_name.app_name 创建交换,这不是我想要的。

我希望在某个时候将这些应用程序与 spring-cloud 配置服务器集成,在那里我可以完全外部化来自不同来源的配置。

有人可以建议我缺少什么以便让 SCDF 获取我的 application.properties 并且 SCDF 是否可以与 Spring Cloud Config Server 一起使用(这应该是我的理解)?任何指针将不胜感激,谢谢。

【问题讨论】:

    标签: spring-cloud spring-cloud-stream spring-cloud-config spring-cloud-dataflow


    【解决方案1】:

    默认情况下,Spring Cloud Stream 绑定属性由 SCDF 使用您上面提到的约定在内部设置。

    您在应用级别定义的application.properties 具有最低优先级,因此它们会被 SCDF 设置的内容覆盖。

    要覆盖 SCDF 设置的这些属性,您需要通过流 deployment 属性传递新属性。你可以参考这个here的文档

    如果您使用 Spring Cloud Config 服务器来提供外部化属性,我相信这些只能用作流 definition 属性,而不是像我们传递的 deployment 属性那样覆盖 Spring Cloud流绑定属性。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-06-03
      • 2015-08-03
      • 2019-12-07
      • 2016-08-19
      • 1970-01-01
      • 1970-01-01
      • 2023-03-24
      相关资源
      最近更新 更多