本文介绍了为什么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",则对我而言,第一个匹配项是 Spring Boot问题跟踪器中的一个问题,简要描述了为什么不支持该问题:

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:

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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-09 13:43