我刚刚开始研究 Spring 4 stomp over websocket。这两者有什么区别?我应该使用哪种情况而不是另一种情况?
没有区别:MessageSendingOperations
是一个接口-契约。SimpMessagingTemplate
是第一个的具体实现。
通常,为具体实现配置 bean 就足够了,但可以通过其契约类型来注入它:
@Bean
public MessageSendingOperations messagingTemplate() {
return new SimpMessagingTemplate(this.inputChannel);
}
...
@Component
public class MyService {
@Autowired
private MessageSendingOperations messagingTemplate;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)