【问题标题】:Camel Spring Boot Actuator Not Working In ContainerCamel Spring Boot 执行器在容器中不起作用
【发布时间】:2017-11-02 22:51:17
【问题描述】:

我使用 this Camel 示例作为参考,并将 Initializer 更改为扩展 SpringBootServletInitializer 以便我可以部署到 JBoss EAP 6.4。

将其作为 SpringBoot 应用程序运行时:

  • /info 等 Spring Actuator 端点工作。 /health 甚至返回 Camel 上下文的运行状况,但是像 /routes 这样的 Camel Actuator 端点返回 http 404。

部署到 JBoss 时:

  • 执行器端点均不起作用。它们都返回 http 404。

这个问题并不是演示所独有的,我们在 JBoss 中运行的所有容器化 Camel Spring Boot 应用程序都存在同样的问题,需要明确的是,这些应用程序在其他方面都是完全正常的。


bootstrap.yml

camel:
   springboot:
     name: Demo
  health:
    check:
      routes:
        enabled: true
      indicator:
        enabled: true
endpoints:
  actuator:
    enabled: true
  health:
    enabled: true
management:
  security:
    enabled: false

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.8.RELEASE</version>
        <relativePath/>
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-spring-boot-starter</artifactId>
            <version>2.20.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-stream-starter</artifactId>
            <version>2.20.0</version>
        </dependency>
    </dependencies>
</project>

【问题讨论】:

  • 你能解决你的问题吗?
  • @ImranRazaKhan 还没有。

标签: jboss apache-camel spring-boot-actuator


【解决方案1】:

Application.yml文件中使用。

camel:
  springboot:
    health.indicator.enabled:true
management:
  security:
    enabled:false

【讨论】:

  • 我在访问 spring 特定端点时遇到了同样的问题,例如与 Camel 无关的普通 @RestController。对于任何此类请求,它都会转发给无法识别 spring 特定端点的 CamelServlet。对此有什么想法吗?
猜你喜欢
  • 2018-07-03
  • 1970-01-01
  • 2014-09-11
  • 2018-07-08
  • 1970-01-01
  • 1970-01-01
  • 2017-11-10
  • 1970-01-01
  • 2021-10-17
相关资源
最近更新 更多