首页 文章

Camel Spring Boot Actuator不使用cxfrs路由

提问于
浏览
1

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

Spring Actuator endpoints 像/ 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}");

application.properties

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

Update: 如果我添加spring-boot-starter-web,它会在http://localhost:8080/healthhttp://localhost:8080/camel/health上显示状态 . 从日志中它显示启动两个不同的服务器jetty和tomcat . 我们可以这样配置SpringBoot使用"cxf-rt-transports-http-jetty"或Camel cxfrs使用SpringBoot Jetty "spring-boot-starter-jetty" .

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

1 回答

  • 0

    您可以通过在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>
    

相关问题