小编bel*_*elo的帖子

Spring Web Reactive不能作为Tomcat 8.5上部署的war文件运行

我有Spring Boot(2.0.0 M5)应用程序,它提供了一些REST API.我想用RouterFunctions 实现这个API .

当我使用嵌入式Jetty运行app时,一切正常.

当我将应用程序转换为WAR文件(此处的文档)并将其部署到Tomcat 8.5时,我总是404在尝试调用任何端点时获得.

我可以在日志中看到端点被识别:

[ost-startStop-1] s.w.r.r.m.a.RequestMappingHandlerMapping : Mapped "{[/say-hello],methods=[GET]}" onto java.lang.String com.example.demo.DemoController.test()
[ost-startStop-1] o.s.w.r.f.s.s.RouterFunctionMapping: Mapped /api => {
    /v1 => {
       /status -> 
          com.example.demo.DemoApplication$$Lambda$189/1904651750@5fdc83e
   }
}
Run Code Online (Sandbox Code Playgroud)

但是在调用时curl -v http://localhost:8080/demo/say-hello或者curl -v http://localhost:8080/demo/api/v1/status我看到默认的Tomcat 404页面.路径是正确的,我demo.war在部署它之前重命名.war .

有没有人遇到类似的问题?你可以在这里找到代码.

java spring-boot spring-webflux

7
推荐指数
1
解决办法
592
查看次数

标签 统计

java ×1

spring-boot ×1

spring-webflux ×1