Circular dependency error when restConfiguration is defined in a Spring beans XML

Solution Verified - Updated -

Issue

When declaring a restConfiguration in a Spring Beans XML file, for example

<camelContext id="SampleCamel" xmlns="http://camel.apache.org/schema/spring">
    <restConfiguration port="8080" bindingMode="off" scheme="http"
                       contextPath="myapi" apiContextPath="myapi/swagger">
    </restConfiguration>

The Camel Spring Boot application does not start due to a circular references error. in particular:

***************************
APPLICATION FAILED TO START
***************************

Description:

The dependencies of some of the beans in the application context form a cycle:

   sampleRoute defined in file [/private/tmp/camel-spring-boot-examples/xml-import/target/classes/sample/camel/SampleRoute.class]
┌─────┐
|  SampleCamel
↑     ↓
|  org.apache.camel.model.rest.springboot.RestConfigurationDefinitionAutoConfiguration (field private org.apache.camel.CamelContext org.apache.camel.model.rest.springboot.RestConfigurationDefinitionAutoConfiguration.camelContext)
└─────┘

Environment

Red Hat Camel build for SpringBoot version 4.4

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content