简体   繁体   English

当 spring-web 存在时,Spring Reactive WebSocket 不会出现

[英]Spring Reactive WebSocket does not come up when spring-web is present

I have an existing spring web application that uses spring-boot-starter-web;我有一个使用 spring-boot-starter-web 的现有 spring web 应用程序; I have been planning to introduce reactive into this application.我一直计划在这个应用程序中引入反应式。 For a new feature that I am working, I have pulled in spring reactive web socket, configured and coded as specified in the spring doc;对于我正在使用的新功能,我引入了 spring 反应式 Web 套接字,按照 spring 文档中的规定进行配置和编码; but unfortunately it does not work (got 404).但不幸的是它不起作用(得到 404)。 I tried a sample application and that works perfectly.我尝试了一个示例应用程序,效果很好。 I used this one as my sample application.我用这一个作为我的示例应用程序。

I found that the sample application comes up on Netty, not on Tomcat.我发现示例应用程序出现在 Netty 上,而不是 Tomcat 上。 So I added spring-boot-starter-web to it, got the server to start in Tomcat and got the same 404 as I got in my application.因此,我向其中添加了 spring-boot-starter-web,让服务器在 Tomcat 中启动并获得与我在应用程序中获得的 404 相同的 404。 I also added TomcatRequestUpgradeStrategy unsuccessfully.我也添加 TomcatRequestUpgradeStrategy 失败。

should I assume that spring-web and spring-webflux conflict with each other and I should go back to the regular websocket?我应该假设 spring-web 和 spring-webflux 相互冲突,我应该回到常规的 websocket 吗? Please advise.请指教。

Spring said that if both spring web and spring webflux present in the classpath; Spring 表示如果类路径中同时存在 spring web 和 spring webflux; spring web kicks in and reactive websocket won't come up. spring web 启动,响应式 websocket 不会出现。 More details here: https://github.com/spring-projects/spring-boot/issues/23236更多细节在这里: https : //github.com/spring-projects/spring-boot/issues/23236

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM