【发布时间】:2021-04-14 12:21:44
【问题描述】:
我尝试了非常简单的路线:
restConfiguration()
.component("servlet");
rest().get("/hello")
.to("direct:hello");
from("direct:hello")
.log(LoggingLevel.INFO, "Hello World")
.transform().simple("Hello World");
确实,在启动我的 Spring Boot 应用程序时,我可以看到路由在监听它: [在此处输入图片说明][1]
2021-04-14 15:03:31.759 INFO 25248 --- [main] o.a.c.i.e.InternalRouteStartupManager:路由:route1 开始并使用:direct://hello 2021-04-14 15:03:31.760 INFO 25248 --- [main] o.a.c.i.e.InternalRouteStartupManager:路由:route2 开始并使用:servlet:/hello 2021-04-14 15:03:31.768 INFO 25248 --- [main] o.a.c.impl.engine.AbstractCamelContext :共有 2 条路线,其中 2 条已启动 2021-04-14 15:03:31.768 INFO 25248 --- [main] o.a.c.impl.engine.AbstractCamelContext:Apache Camel 3.7.1 (camel-1) 在 220 毫秒内启动
但是,当我尝试到达此地址时,我收到 404 错误。
{ "时间戳": "2021-04-14T12:17:11.975+00:00", “状态”:404, “错误”:“未找到”, “信息”: ””, “路径”:“/你好” }
在我的控制台中: 2021-04-14 15:17:11.973 WARN 25248 --- [nio-8080-exec-4] os.web.servlet.PageNotFound : 没有 GET /hello 的映射
知道如何解决吗? 我会在这里说,我用谷歌搜索了这个问题和解决方案,比如使用“camel.component.servlet.mapping.context-path=/* " 或使用 "camel" 前缀对我不起作用。
谢谢!
【问题讨论】:
标签: apache-camel