为什么spring-websocket中的STOMP功能依赖于Spring MVC? [英] Why does STOMP functionality in spring-websocket depend on Spring MVC?

查看:533
本文介绍了为什么spring-websocket中的STOMP功能依赖于Spring MVC?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我正在尝试将STOMP与使用webflux的websocket一起使用.为了将消息发送到STOMP主题,我需要使用SimpMessagingTemplate,这是我添加@EnableWebSocketMessageBroker

Currently, I am trying to use STOMP with websockets using webflux. In order to send a message to a STOMP topic, I need to use SimpMessagingTemplate, which is contributed by spring boot auto configuration when I add @EnableWebSocketMessageBroker

但是问题是,@EnableWebSocketMessageBroker间接希望我在类路径中有spring-mvc

But the problem with this is, @EnableWebSocketMessageBroker indirectly expects me to have spring-mvc library in classpath

@EnableWebSocketMessageBroker @Import s DelegatingWebSocketMessageBrokerConfiguration,扩展了WebSocketMessageBrokerConfigurationSupport& WebSocketMessageBrokerConfigurationSupport#stompWebSocketHandlerMapping方法期望返回类HandlerMapping

@EnableWebSocketMessageBroker @Imports DelegatingWebSocketMessageBrokerConfiguration which extends WebSocketMessageBrokerConfigurationSupport & WebSocketMessageBrokerConfigurationSupport#stompWebSocketHandlerMapping method expects the class HandlerMapping to be returned

我的问题是

  1. 如何在没有webmvc的情况下将STOMP与webflux集成
  2. 为什么自动配置会迫使我们在类路径中使用mvc(并可能与webflux冲突)

推荐答案

如果您在Google上搜索"stomp webflux",则对我而言,第一个匹配项是

If you search for "stomp webflux" on Google, the very first hit (for me) is an issue in the Spring Boot issue tracker that shortly describes why it isn't supported:

一般的目的是提供与WebFlux一致的更高级别的消息支持,但是还没有特定的目标版本.请注意,我们正在研究gRPC 和RSocket支持,它们在同一常规类别中.

There is a general intent to provide higher-level, messaging support aligned with WebFlux, but there is no specific target release yet. Note that we are researching gRPC and RSocket support, which are in the same general category.

5.2行中已经开始了对RSocket的支持,因此您可能需要看一下.

Support for RSocket has been started in the 5.2 line so you may want to have a look to that.

这篇关于为什么spring-websocket中的STOMP功能依赖于Spring MVC?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆