Spring Web Reactive does not work as a war file deployed on Tomcat 8.5

I have a Spring Boot application (2.0.0 M5) that provides some REST API. I would like to implement this API using RouterFunction s.

While I run the application using the built-in Jetty, everything is working fine.

When I convert an application to a WAR file (following the documentation here ) and deploy it to Tomcat 8.5, I always get 404 when trying to call any of the endpoints.

I see in the log that endpoints are recognized:

 [ost-startStop-1] swrrmaRequestMappingHandlerMapping : Mapped "{[/say-hello],methods=[GET]}" onto java.lang.String com.example.demo.DemoController.test() [ost-startStop-1] oswrfssRouterFunctionMapping: Mapped /api => { /v1 => { /status -> com.example.demo.DemoApplication$$Lambda$189/ 1904651750@5fdc83e } } 

But when I call curl -v http://localhost:8080/demo/say-hello or curl -v http://localhost:8080/demo/api/v1/status I see the default Tomcat 404 page. The path is correct, I renamed .war to demo.war before deploying it.

Has anyone encountered a similar problem? You can find the code here .

+5
source share
1 answer

I am afraid that the WAR deployment model is not supported in Spring Boot for WebFlux at the moment. The Spring Framework supports this model (although I'm not sure that it supports application deployment in a non-root context).

You can always create a problem on the Spring Boot Error Tracker , but I'm not sure that this will be implemented, since deploying to the Servlet container is not the main focus there (and you cannot do this with Netty).

Quick note: adding @EnableWebFlux is a signal that you would like to use in your WebFlux configuration, and that Spring Boot should not automatically configure things for you in this space.

+1
source

Source: https://habr.com/ru/post/1272568/


All Articles