我已经使用Spring开发了一个Camel路由。我使用STS4集成开发环境进行了同样的开发。
当我使用Run As-> Spring Boot App启动应用程序时,应用程序启动,我还可以从日志中看到路由已启动。我的路由是一个基本的应用程序,它显示一个rest端点并记录一个Hello World
@Override
public void configure() throws Exception {
restConfiguration()
.enableCORS(true)
.apiContextPath("/api-doc")
.apiProperty("api.title", "Test REST API")
.apiProperty("api.version", "v1")
.apiContextRouteId("doc-api")
.component("servlet")
.bindingMode(RestBindingMode.json);
rest("/api/")
.id("api-route")
.consumes("application/json")
.get("/test")
.to("direct:log");
from("direct:log")
.id("log")
.log(LoggingLevel.INFO,"Test successful");
}我期望的是,如果我执行localhost:8080/api/test,我将在Tomcat日志中看到一些日志"Test Susccessful“。我使用的是Tomcat9,而不是WhiteLable error。我认为我的代码有问题,所以我尝试了localhost:8080,我希望Tomcat Management服务器能够打开。即使这样也行不通。
我不会单独启动Tomcat。我正在做的是运行为-> Spring Boot App,我猜它调用的是嵌入式tomcat。
发布于 2019-08-05 12:49:32
这个答案归功于@Bedla。我不得不在URL路径http://localhost:8080/camel/api/test中添加camel
https://stackoverflow.com/questions/57338158
复制相似问题