Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/338.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何将Spring Boot中的Jetty与Camel Jetty组件一起使用?_Java_Spring_Spring Boot_Apache Camel_Jetty - Fatal编程技术网

Java 如何将Spring Boot中的Jetty与Camel Jetty组件一起使用?

Java 如何将Spring Boot中的Jetty与Camel Jetty组件一起使用?,java,spring,spring-boot,apache-camel,jetty,Java,Spring,Spring Boot,Apache Camel,Jetty,我有一个Spring引导应用程序,它使用Camel jetty组件作为网关,使用Camel端点路由 @Component public class StartEcommerce extends RouteBuilder { @Override public void configure() throws Exception { restConfiguration() .host("localhost") .port(8085); re

我有一个Spring引导应用程序,它使用Camel jetty组件作为网关,使用Camel端点路由

@Component
public class StartEcommerce extends RouteBuilder {

  @Override
  public void configure() throws Exception {

    restConfiguration()
        .host("localhost")
        .port(8085);

    rest("/rest/v1")
        .post("/order")
            .to("direct:ecommerceRestRoute")
        .post("/cancelEnrollment")
            .to("direct:cancelEnrollmentRestRoute");

    // other routes ... 
  }
}

如果我将jetty组件放在端口8085中执行,一切正常

但是,我想使用Spring Boot的jetty,它已经在端口8081中运行,因为我想从actuator访问healthcheck端点,并能够像这样调用我的rest端点:

localhost:8081/health
localhost:8081/rest/v1/order
localhost:8081/rest/v1/cancelEnrollment
我试着跟随这个讨论

但我得到了下面的错误,因为我有两个码头运行在同一个港口

***************************
APPLICATION FAILED TO START
***************************

Description:

Embedded servlet container failed to start. Port 8081 was already in use.

Action:

Identify and stop the process that's listening on port 8081 or configure this application to listen on another port.
我正在使用camel jetty 2.18.0和Spring Boot 1.4.2.0版本


有什么建议吗?

我找到了解决方案,我的build.gradle中设置了不正确的依赖项

compile('org.apache.camel:camel-jetty:2.18.0')
此外,我从路由中删除rest配置:

restConfiguration()
   .host("localhost")
   .port(8081);
下面是克劳斯·易卜生的例子


嗨,Higor Oliveira,您是否最终使用了上面github示例链接中解释的
servlet
组件?你能发布你的解决方案吗?干杯