java - Spring Cloud Bus Kafka Bean 配置
问题描述
我不太喜欢在我的配置中使用 application.yml 或 bootstrap.yml。
您知道任何可以用作 bean 以配置以下属性的类吗?
spring:
cloud:
bus:
enabled: true
stream:
kafka:
binder:
zkNodes: localhost:9092
brokers: localhost:2181
我的目标是得到这样的东西:
@Configuration
public class myConfiguration {
@Bean
public Object myCloudBusConfig() {
Object config = new Object();
config.setCloudBusEnabled(true);
return config;
}
}
此外,作为未来的参考(可能更棘手),我如何确定/找到哪些类引用特定属性?属性名称和源包之间是否存在关联?
这对我有很大帮助:)
解决方案
推荐阅读
- python - 根据 pandas 中的时间戳创建交互会话
- sql - SSDT 在比较和发布中跳过 NOCHECK 约束
- assembly - 具有 32 个地址位和 16 个数据位的存储器的容量为?
- r - 如何将列表类变量更改为r中的字符串
- go - 返回 Golang 中 strings.Split() 切片的最后一项
- jupyter-notebook - Jupyter:我如何回忆和编辑以前的“In:”文本?
- awk - awk 脚本管道改变了明显的执行顺序
- laravel-5 - 每个 laravel/homestead 项目的单独数据库
- java - C# TCP客户端在关闭前不发送数据
- java - 整数计数错误