Rakeshkumaran
Rakeshkumaran

Reputation: 11

Apache camel version upgrade 3.20.3 to 4.4.2 - Circular dependency issue arises

We are trying to update java,camel,boot version upgrade respectively as below, but getting below exception while running Junit test cases not tried deploying into server so far. Maven Clean install is done. Test cases running fine if we update jdk from 11 to 17. Spring boot and apache camel version upgrade gives this. Boot 2.5.2 -> 3.2.6 camel 3.20.3 -> 4.4.2 Java 11 -> 7


java.lang.IllegalStateException: Failed to load ApplicationContext for [WebMergedContextConfiguration@5a564a61 testClass = NorthDataRoutesTest, locations = ["classpath:/camel-context.xml"], classes = [], contextInitializerClasses = [], activeProfiles = ["dev"], propertySourceDescriptors = [], propertySourceProperties = ["org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true"], contextCustomizers = [[ImportsContextCustomizer@3aee72d8 key = [@org.apache.camel.test.spring.junit5.CamelSpringBootTest(), @org.springframework.boot.test.context.SpringBootTest(args={}, classes={}, properties={}, useMainMethod=NEVER, value={}, webEnvironment=MOCK), @org.springframework.context.annotation.Import(value={org.springframework.boot.autoconfigure.AutoConfigurationPackages.Registrar.class}), @org.springframework.context.annotation.ComponentScan(basePackageClasses={}, basePackages={"testConfiguration"}, excludeFilters={}, includeFilters={}, lazyInit=false, nameGenerator=org.springframework.beans.factory.support.BeanNameGenerator.class, resourcePattern="**/*.class", scopeResolver=org.springframework.context.annotation.AnnotationScopeMetadataResolver.class, scopedProxy=DEFAULT, useDefaultFilters=true, value={"testConfiguration"}), @org.springframework.test.context.TestExecutionListeners(inheritListeners=true, listeners={org.apache.camel.test.spring.junit5.CamelSpringTestContextLoaderTestExecutionListener.class, org.apache.camel.test.spring.junit5.CamelSpringBootExecutionListener.class, org.apache.camel.test.spring.junit5.StopWatchTestExecutionListener.class}, mergeMode=MERGE_WITH_DEFAULTS, value={org.apache.camel.test.spring.junit5.CamelSpringTestContextLoaderTestExecutionListener.class, org.apache.camel.test.spring.junit5.CamelSpringBootExecutionListener.class, org.apache.camel.test.spring.junit5.StopWatchTestExecutionListener.class}), @org.apiguardian.api.API(consumers={"*"}, since="5.0", status=STABLE), @org.springframework.boot.autoconfigure.EnableAutoConfiguration(exclude={}, excludeName={}), @org.springframework.context.annotation.Import(value={org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.class}), @org.springframework.test.context.ContextConfiguration(classes={}, inheritInitializers=true, inheritLocations=true, initializers={}, loader=org.springframework.test.context.ContextLoader.class, locations={"classpath:/camel-context.xml"}, name="", value={"classpath:/camel-context.xml"}), @org.springframework.test.context.ActiveProfiles(inheritProfiles=true, profiles={"dev"}, resolver=org.springframework.test.context.ActiveProfilesResolver.class, value={"dev"}), @org.springframework.boot.autoconfigure.AutoConfigurationPackage(basePackageClasses={}, basePackages={}), @org.springframework.test.context.BootstrapWith(value=org.springframework.boot.test.context.SpringBootTestContextBootstrapper.class)]], org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@418c5a9c, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@332729ad, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@7b8b43c7, org.springframework.boot.test.autoconfigure.actuate.observability.ObservabilityContextCustomizerFactory$DisableObservabilityContextCustomizer@1f, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizer@3f67593e, org.springframework.boot.test.context.SpringBootTestAnnotation@c791c0a8], resourceBasePath = "src/main/webapp", contextLoader = org.springframework.boot.test.context.SpringBootContextLoader, parent = null]

    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:180)
    at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:130)
    at org.apache.camel.test.spring.junit5.CamelSpringBootExecutionListener.prepareTestInstance(CamelSpringBootExecutionListener.java:61)
    at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:247)
    at org.springframework.test.context.junit.jupiter.SpringExtension.postProcessTestInstance(SpringExtension.java:163)
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
    at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
    at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:310)
    at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:735)
    at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:734)
    at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
    at java.base/java.util.Optional.orElseGet(Optional.java:364)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'template': Error creating bean with name 'camel-1': Error creating bean with name 'org.apache.camel.impl.health.DefaultHealthCheckRegistry': Error creating bean with name 'camel-1': Requested bean is currently in creation: Is there an unresolvable circular reference?
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:608)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:523)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325)

Tried below things,

Upvotes: 1

Views: 252

Answers (1)

Girish G
Girish G

Reputation: 54

Try with adding spring.main.allow-circular-references=true in your application.properties

Upvotes: 0

Related Questions