Spring boot Camel Rest endpoint not working

51 Views Asked by At

I have the following configuration for spring boot camel project and I get 404 error back when I am trying to call the endpoint. I am calling the endpoint from a browser.

POM:

<dependencyManagement>

        <dependencies>
            <!-- Camel BOM -->
            <dependency>
                <groupId>org.apache.camel.springboot</groupId>
                <artifactId>camel-spring-boot-bom</artifactId>
                <version>${project.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <!-- ... other BOMs or dependencies ... -->
        </dependencies>

    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.camel.springboot</groupId>
            <artifactId>camel-spring-boot-starter</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.camel.springboot</groupId>
            <artifactId>camel-servlet-starter</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-netty-http</artifactId>
            <!-- use the same version as your Camel core version -->
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

application.properties:

camel.rest.component.servlet.mapping.context-path=/api/*
camel.component.servlet.mapping.contextPath=/api/*
server.address=0.0.0.0
management.address=localhost
management.port=8081
endpoints.enabled = true
endpoints.health.enabled = true

RouterBuilder extended class:

@Override
    public void configure() throws Exception {

        restConfiguration().component("servlet");

        rest("hello")
                .get()
                .to("direct:hello");

        from("direct:hello")
                .log("direct")
                .transform().constant("Bye World");
    }

Any suggestions? Thank you!

0

There are 0 best solutions below