我正在尝试构建一个插入Spring Boot应用程序的模块。这个模块应该暴露一些REST端点,我尝试用Camel构建它们,因为我不想在web.xml上添加东西等等。
restConfiguration().component("servlet")
.contextPath("/my")
.apiContextPath("/api-doc")
.apiProperty("api.title", "My REST API")
.apiProperty("cors", "true")
.apiContextRouteId("my-api")
.bindingMode(RestBindingMode.json);
rest("/my").description("My REST Services")
.get("foo/{id}").route().routeId("foo")
.to("direct:foo");
from("direct:foo")
.process(new FooParamParser())
.log("Done");
我遇到的问题是,不是在/ my / foo / 123?status = abc我必须在/ camel / my / foo / 123?status = abc点击它。
它这样做是因为它默认使用Camel Servlet作为DSL的REST端点,我很好,但我不想要它把" /骆驼"在我的道路开始。我应该注意,无论有没有.component("servlet")
有什么方法可以改变吗?
答案 0 :(得分:4)
您可以在application.properties或application.yml
中控制它例如
camel.component.servlet.mapping.contextPath=/api/*