java - 为什么 ${spring.embedded.kafka.brokers} 没有填充到 application-test.yaml 虽然我看到 spring.embedded.kafka.brokers 存在?
问题描述
我们正在使用@EmbeddedKafka
,并且application-test.yml
我们有
kafka:
confluentBootstrapAddress: ${spring.embedded.kafka.brokers}
我可以看到那confluentBootstrapAddress
是null
。
但是,如果在调试模式下,我会检查这个
this.resolveEmbeddedValue("${spring.embedded.kafka.brokers}") = "127.0.0.1:51020"
然后我可以看到该值存在,并且嵌入式 Kafka 确实已启动。
可能是什么问题?application.yml
评估时刻与嵌入式代理启动时的生命周期/时刻不匹配?
解决方案
实际上,在使用@Profile
而不是@ActiveProfiles
. 将其更改为ActiveProfiles
使 Spring Test 考虑到"spring-profile.properties"
.
推荐阅读
- google-cloud-platform - 创建 dataproc 工作流模板时出错
- ruby-on-rails - 向邮件程序添加活动存储表示的最佳方法是什么?
- python - 优化后的特征名称
- r - 将 csv 导入 r 时,为什么在第一个 colname 的前面有 'ï..'?
- jupyter-notebook - 在 Jupyter 中,如何使用鼠标滚轮水平滚动?
- android - ext vs dependencies 块内的Android依赖版本
- html - 无法在响应中居中元素
- html - 使 HTML 表格行“非活动”
- android - 我正在使用 mesibo 聊天 SDK,当我尝试在 mesibo 消息侦听器接口的 (onMessage) 实现功能上显示通知时
- ios - 从其他应用程序、Microsoft Teams、Messenger、WhatsApp 等打开 SwiftUI 应用程序