Getting error "The dependencies of some of the beans in the application context form a cycle"

Solution Verified - Updated -

Issue

When trying to start a Camel integration with Spring Boot runtime, the following error appears after trying to start the integration

***************************
APPLICATION FAILED TO START
***************************
Description:
The dependencies of some of the beans in the application context form a cycle:
activemq defined in class path resource [META-INF/spring/camel-context.xml]
┌─────┐
| camelContext
↑ ↓
| shutdown defined in class path resource [META-INF/spring/camel-context.xml]
└─────┘
Action:
Relying upon circular references is discouraged and they are prohibited by default. Update your application to remove the dependency cycle between beans. As a last resort, it may be possible to break the cycle automatically by setting spring.main.allow-circular-references to true.

Environment

  • Fuse 7.x
  • Camel 2.x
  • May happen on any deployment type (SpringBoot, Karaf, EAP)
  • Example file camel-context.xml attached

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