![](/img/trans.png)
[英]How to set Binders for Spring Cloud Stream Bindings on different RabbitMQ vhosts
[英]How to autowire spring stream cloud bindings
我在application.yml
定義了error
和notification
綁定
cloud:
stream:
bindings:
error:
destination: error
binder: default
notification:
destination: notification
binder: default
如何在組件中獲取這些bean?
我嘗試了這種方法:
@Component
class MyComponent {
@Autowired
@Qualified("notification")
MessageChannel notificationChannel;
}
但是沒有找到notificationChanel
。
更新 cloud.stream.bindings.*
僅允許配置通道。 但是不會創建它。
您確定您具有@EnableBinding
和適當的接口來聲明@Input
或@Output
嗎?
public interface Barista {
@Input
SubscribableChannel orders();
@Output
MessageChannel hotDrinks();
@Output
MessageChannel coldDrinks();
}
...
@EnableBinding(Barista.class)
public class CafeConfiguration {
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.