Search code examples
spring-bootspring-websocketspring-reactive

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; 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; but unfortunately it does not work (got 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. 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. I also added TomcatRequestUpgradeStrategy unsuccessfully.

should I assume that spring-web and spring-webflux conflict with each other and I should go back to the regular websocket? Please advise.


Solution

  • Spring said that if both spring web and spring webflux present in the classpath; spring web kicks in and reactive websocket won't come up. More details here: https://github.com/spring-projects/spring-boot/issues/23236