How to create channels with Spring 4 annotation based?

…衆ロ難τιáo~ 提交于 2019-12-11 04:04:08

问题


I want to create a socket channel with a rendezvous queue where a client and server can exchange a simple message.

But I already fail to convert the following xml to annotation based spring-4 configuration:

<int:channel id="rendezvousChannel"/>
    <int:rendezvous-queue/>
</int:channel>

How would this look like in spring 4?


回答1:


The short answer:

@Bean
public PollableChannel rendezvousChannel() {
   return new RendezvousChannel();
}

Can you explain why it was an issue for you to find the solution from your side?

Any XML component is backed by some Java class anyway and most cases their names reflect the XML component names.



来源:https://stackoverflow.com/questions/29349174/how-to-create-channels-with-spring-4-annotation-based

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!