当前位置: 首页 > 知识库问答 >
问题:

骆驼Spring引导执行器不能与cxfrs路线一起工作

越狐若
2023-03-14

我已经使用springboot+camel开发了简单的基于cxfrs的路由,但是当我添加spring-boot-starter-actulator并将其作为@springbootapplication运行时:

Spring致动器endpoint类似/health不工作,并返回http 404。

from("cxfrs:http://127.0.0.1:8181?resourceClasses=org.imran.greenfarm.services.OrderService&bindingStyle=SimpleConsumer&providers=#jsonProvider&features=#featuresList")
    .to("log:?showAll=true")
    .toD("direct:${header.operationName}");

应用程序.属性

# all access to actuator endpoints without security
management.security.enabled = false
# turn on actuator health check
endpoints.health.enabled = true

更新:如果我添加了spring-boot-starter-web,它将显示http://localhost:8080/health或http://localhost:8080/camel/health上的状态。从日志中可以看到两个不同服务器jetty和Tomcat的启动。我们是否可以这样配置,使SpringBoot使用“cxf-rt-transports-http-jetty”或Camel cxfrs使用SpringBoot Jetty“spring-boot-starter-jetty”。

如果我们在属性中提供management.port=8181,它会抛出已经使用的端口。

共有1个答案

岳泳
2023-03-14

您可以通过在pom.xml中添加以下内容来添加springboot jetty,您必须排除默认的tomcat

<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-tomcat</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jetty</artifactId>
    </dependency> 
 类似资料:
  • 我使用这个Camel示例作为参考,并更改了初始化器以扩展,以便可以部署到JBoss EAP6.4。 当它作为SpringBoot应用程序运行时: null 部署到JBoss时: 执行器endpoint均不工作。它们都返回http 404。 这个问题并不是演示所独有的,我们在JBoss中运行的所有容器化Camel Spring Boot应用程序都有同样的问题,并且需要明确的是,这些应用程序的功能完全

  • 我正在尝试将我目前正在进行的项目从Spring Boot1.2.8升级到最新版本(1.4.0)。我发现,自1.3.0版本以来的Spring Boot执行器将Flyway迁移作为执行器endpoint公开。此endpoint将单个Flyway bean作为参数。 https://github.com/spring-projects/spring-boot/blob/master/spring-boo

  • 我的Apache骆驼项目开始有一个相当好的结构,但我陷入了困境,因为我的routeContext中的路由无限执行。我的所有路由都使用SQL组件,我希望所有路由只执行一次。 我发现,当我的routeContext中有两条路由时,两条路由都只执行一次,但是一旦我添加了第三条路由(不管第三条路由是什么),camel就开始无限执行所有路由。我所有的路由都导致sql插入,因此相同的路由运行多次会导致重复键错

  • 我添加了执行器依赖 按照教程中的建议 但是当我点击时,它不会给出预期的结果。上面写着 Spring Boot版本为1.5.4。和Java1.8需要做哪些附加设置?

  • 我有一个Springboot应用程序,其中配置了一些驼峰路线。 我想测试从到的路由。我试过这里提到的不同东西http://camel.apache.org/camel-test.html,但似乎无法让它工作。 我正在尝试这样做: 但是我的ProducerTemplate总是。我尝试了自动连接CamelContext,但遇到一个异常,它无法解析CamelContext。但这可以通过添加到类。但是我的

  • 执行器功能是通过在项目中添加“Spring-启动-启动-执行器”来提供的。 此时,security被禁用,因此项目不会导入Spring-Security。 使用spring-boot 1.5.x,所有执行器endpoint(自动提供,作为/info,以及我特定定义的endpoint)都正常工作。 使用spring-boot 1.5.x时,tomcat.version=9.0.0.m9 使用spri