为什么spring-websocket中的STOMP功能依赖于Spring MVC?

问题描述 投票:0回答:1

目前,我正在尝试使用带有webflux的websockets的STOMP。为了向STOMP主题发送消息,我需要使用SimpMessagingTemplate,当我添加@EnableWebSocketMessageBroker时由spring boot auto配置提供

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

扩展@EnableWebSocketMessageBroker@Import方法的DelegatingWebSocketMessageBrokerConfiguration WebSocketMessageBrokerConfigurationSupports WebSocketMessageBrokerConfigurationSupport#stompWebSocketHandlerMapping期望返回班级HandlerMapping

我的问题是

  1. 如何在没有webmvc的情况下将STOMP与webflux集成
  2. 为什么自动配置强制我们在类路径中使用mvc(并且可能与webflux冲突)
spring-webflux spring-websocket stomp spring-messaging
1个回答
2
投票

如果您在Google上搜索“stomp webflux”,那么第一个(对我而言)是an issue in the Spring Boot issue tracker,它很快就会描述为什么它不受支持:

一般意图提供与WebFlux一致的更高级别的消息传递支持,但目前还没有特定的目标版本。请注意,我们正在研究gRPC和RSocket支持,它们属于同一类。

已经在5.2系列中启动了对RSocket的支持,因此您可能希望了解它。

© www.soinside.com 2019 - 2024. All rights reserved.