2017-02-17 154 views
0

我有一個使用駱駝碼頭組件作爲網關的駱駝端點路由的Spring Boot應用程序。如何使用Camel Jetty組件的Spring Boot中的Jetty?

@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 ... 
    } 

}

一切工作正常,如果我把碼頭分量端口執行8085.

不過,我想使用已經在8081端口上運行春季啓動的碼頭,因爲我想有機會獲得健康檢查從執行端點和能叫我休息端點這樣的:

localhost:8081/health 
localhost:8081/rest/v1/order 
localhost:8081/rest/v1/cancelEnrollment 

試圖按照這種討論

Use existing http server in spring boot as camel endpoint

,但我得到了下面的錯誤,因爲我有相同的端口

*************************** 
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. 

上運行兩個Jettys我用駱駝碼頭2.18.0的春天引導1.4.2。發佈。

任何建議我該如何做到這一點?

回答