我在 application.yml
error
和 notification
绑定 cloud:
stream:
bindings:
error:
destination: error
binder: default
notification:
destination: notification
binder: default
如何将这些豆子放在我的组件中?
我尝试了这种方法:
@Component
class MyComponent {
@Autowired
@Qualified("notification")
MessageChannel notificationChannel;
}
但找不到notificationChanel
。
更新 cloud.stream.bindings.*
仅允许配置通道。但不会创建它。
您是否确定您有@EnableBinding
和适当的接口来声明@Input
或@Output
?
https://docs.spring.io/spring-cloud-stream/docs/chelsea.sr2/reference/htmlsingle/index.html#declaring_and_and_and_and_binding_channels
public interface Barista {
@Input
SubscribableChannel orders();
@Output
MessageChannel hotDrinks();
@Output
MessageChannel coldDrinks();
}
...
@EnableBinding(Barista.class)
public class CafeConfiguration {