亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

各位大佬,我有個問題自己折騰好久沒解決了

public?interface?StreamClient?{

????String?input=?"message";

????@Input(StreamClient.input)
????SubscribableChannel?input();

????@Output(StreamClient.input)
????MessageChannel?output();
}

以上是定義的接口

@Component
@EnableBinding(StreamClient.class)
@Slf4j
public?class?StreamReceiver?{

????@StreamListener(StreamClient.input)
????public?void?process(Object?message)?{
????????log.info("StreamReceiver:?{}",?message);
????}
}

以上是定義的接受消息的監聽類

@RestController
public?class?SendMessageController?{

????@Autowired
????private?StreamClient?streamClient;

????@GetMapping("/sendMessage")
????public?void?process()?{
????????String?message?=?"now?"?+?new?Date();
????????streamClient.output().send(MessageBuilder.withPayload(message).build());
????}
}

這是定義的發送消息的接口

我是用的stream + rabbitmq,想做消息異步,上面這么寫的話項目一運行就會報錯,如下

org.springframework.beans.factory.BeanDefinitionStoreException:?Invalid?bean?definition?with?name?'input'?defined?in?org.fish.order.message.StreamClient:?bean?definition?with?this?name?already?exists?-?Root?bean:?class?[null];?scope=;?abstract=false;?lazyInit=false;?autowireMode=0;?dependencyCheck=0;?autowireCandidate=true;?primary=false;?factoryBeanName=org.fish.order.message.StreamClient;?factoryMethodName=output;?initMethodName=null;?destroyMethodName=null

搞了好久沒搞出來,十分沮喪,求各位大佬幫幫我!??!

正在回答

1 回答

@Input(StreamClient.input)和@Output(StreamClient.input)通道名不能一樣

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

各位大佬,我有個問題自己折騰好久沒解決了

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號