如何向Spring Cloud Stream Binder的环境添加属性源

问题描述 投票:0回答:1

我编写了一个PropertySource,它为classpath:启用spring.kafka.properties.ssl.truststore.location前缀(不支持即用型)。本质上,这使我可以在我的Spring Boot应用程序的src/main/resources文件夹中放置一个truststore.jks,并从.jar文件中进行引用。

这对于普通的Spring Kafka配置非常有效,如下所示:

spring:
  kafka:
    properties:
      ssl.truststore.location: classpath:myTruststore.jks

当在Spring Cloud Stream Binder的上下文中给出相同的配置时,当前失败:

spring:
  cloud:
    stream:
      binders:
        my-binder:
         type: kafka
         environment:
           spring:
             kafka:
               properties:
                 ssl.truststore.location: classpath:myTruststore.jks

当我希望它的名称为spring.cloud.stream.binders.my-binder.environment.spring.kafka.properties.ssl.truststore.location时,甚至没有回叫我的PropertySource。>

[我认为我可以执行classpath:分辨率的PropertySource不属于给定的Spring Cloud Stream绑定器的Environment的一部分。

问题:

如何将PropertySources添加到特定的Binder环境(或所有这些环境)?

谢谢!

我已经编写了一个PropertySource,它启用spring.kafka.properties.ssl.truststore.location的classpath:前缀(不支持即用型)。本质上,这使我可以放置一个信任库。...

spring spring-boot spring-cloud spring-cloud-stream
1个回答
0
投票

有趣;您是否愿意共享代码和/或将其贡献给spring-kafka?

© www.soinside.com 2019 - 2024. All rights reserved.