Skip to content

ClassNotFoundException (InfraConfiguration) when using axon-spring-cloud without axon-spring-boot-starter #424

Description

@rvvaeke

Basic information

  • Axon Framework version: 4.12.3
  • JDK version: 25
  • Spring Cloud Extension version: 4.12.0
  • Complete executable reproducer if available (e.g. GitHub Repo): demo.zip

Steps to reproduce

  1. Include axon-springcloud-spring-boot-starter
  2. Include axon-framework
  3. Include spring-cloud-commons

Expected behaviour

The Spring application context starts without errors.

Actual behaviour

The Spring application context fails to start with error:

java.lang.IllegalStateException: Failed to load ApplicationContext for [MergedContextConfiguration@10ee04df testClass = com.example.demo.DemoApplicationTests, locations = [], classes = [com.example.demo.DemoApplication, com.example.demo.DemoApplicationTests.TestConfig], contextInitializerClasses = [], activeProfiles = [], propertySourceDescriptors = [], propertySourceProperties = ["axon.distributed.enabled=true", "org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true"], contextCustomizers = [org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@792b749c, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@305ffe9e, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@5a59ca5e, org.springframework.boot.test.web.reactor.netty.DisableReactorResourceFactoryGlobalResourcesContextCustomizerFactory$DisableReactorResourceFactoryGlobalResourcesContextCustomizerCustomizer@4e5ed836, org.springframework.boot.test.autoconfigure.OnFailureConditionReportContextCustomizerFactory$OnFailureConditionReportContextCustomizer@7bd7d6d6, 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@25df00a0, org.springframework.test.context.support.DynamicPropertiesContextCustomizer@0, org.springframework.boot.test.context.SpringBootTestAnnotation@7c8f9b8], 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.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:155)
	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:111)
	at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:260)
	at org.springframework.test.context.junit.jupiter.SpringExtension.postProcessTestInstance(SpringExtension.java:159)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:186)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:214)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:214)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1716)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:570)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:560)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:153)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:176)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:265)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:632)
	at java.base/java.util.Optional.orElseGet(Optional.java:364)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1604)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1604)
Caused by: java.lang.IllegalStateException: Failed to generate bean name for imported class 'org.axonframework.extensions.springcloud.autoconfig.SpringCloudAutoConfiguration'
	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.registerBeanDefinitionForImportedConfigurationClass(ConfigurationClassBeanDefinitionReader.java:167)
	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:141)
	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:120)
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:430)
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:290)
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:349)
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:118)
	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:791)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:609)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:439)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:318)
	at org.springframework.boot.test.context.SpringBootContextLoader.lambda$loadContext$3(SpringBootContextLoader.java:152)
	at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:58)
	at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:46)
	at org.springframework.boot.SpringApplication.withHook(SpringApplication.java:1461)
	at org.springframework.boot.test.context.SpringBootContextLoader$ContextLoaderHook.run(SpringBootContextLoader.java:595)
	at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:152)
	at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:111)
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:225)
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:152)
	... 19 more
Caused by: java.lang.IllegalArgumentException: Could not find class [org.axonframework.springboot.autoconfig.InfraConfiguration]
	at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:372)
	at org.springframework.core.annotation.TypeMappedAnnotation.adapt(TypeMappedAnnotation.java:466)
	at org.springframework.core.annotation.TypeMappedAnnotation.getValue(TypeMappedAnnotation.java:391)
	at org.springframework.core.annotation.TypeMappedAnnotation.asMap(TypeMappedAnnotation.java:278)
	at org.springframework.core.annotation.AbstractMergedAnnotation.asAnnotationAttributes(AbstractMergedAnnotation.java:191)
	at org.springframework.context.annotation.AnnotationBeanNameGenerator.determineBeanNameFromAnnotation(AnnotationBeanNameGenerator.java:147)
	at org.springframework.context.annotation.AnnotationBeanNameGenerator.generateBeanName(AnnotationBeanNameGenerator.java:113)
	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.registerBeanDefinitionForImportedConfigurationClass(ConfigurationClassBeanDefinitionReader.java:163)
	... 39 more
Caused by: java.lang.ClassNotFoundException: org.axonframework.springboot.autoconfig.InfraConfiguration
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:580)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:490)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:547)
	at org.springframework.util.ClassUtils.forName(ClassUtils.java:321)
	at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:362)
	... 46 more

Activity

  1. added theissue type on Feb 4, 2026
  2. smcvb commented on Feb 4, 2026

    @smcvb
    Member

    Firstly, I have removed the bug marker from this ticket, as I do not view this as a bug. The description of the scenario you gave here is, although reasonable, not pointing to anything wrongfully in this extension.
    Added, @rvvaeke, you already gave a perfect solution to the predicament, which is a literally one liner:

    I think if the AutoConfigureBefore annotation declaration is changed from

    @AutoConfigureBefore(InfraConfiguration.class)

    to

    @AutoConfigureBefore(name = "org.axonframework.springboot.autoconfig.InfraConfiguration")

    Given our focus on Axon Framework 5, with a Spring Cloud replacement to come in the near future, we cannot justify our time on this ourselves. Hence, I would like to ask you to make a pull request.

    To be frank with you, we're already making an exception here. We have essentially stopped doing any enhancements for the AF4-extensions since the AF5 release. Trusting to have informed you sufficiently here, @rvvaeke!

  3. added this to the Release 4.12.1 milestone on Feb 12, 2026
  4. added a commit that references this issue on Feb 12, 2026
  5. smcvb commented on Feb 12, 2026

    @smcvb
    Member

    Closing this issue as it has been resolved by PR #425

  6. smcvb commented on Feb 12, 2026

    @smcvb
    Member

    By the way, @rvvaeke, know that I am making an exception with allowing this change. Changes are high this extension will have an entirely different look, feel, and approach for Axon Framework 5.
    As such, we are no longer actively developing or updating the dependencies on this project (as you may have noticed).

    Thus, this repository is currently not prioritized within the team; getting a release out means it comes lower on the pile of work to process. Don't worry, it will happen, just not right away.

  7. smcvb commented on Apr 2, 2026

    @smcvb
    Member

    Hi @rvvaeke, sorry for the hold up on this. But, I just released 4.12.1 of the Spring Cloud extension containing your fix - https://github.com/AxonFramework/extension-springcloud/releases/tag/axon-springcloud-4.12.1
    Figured you'd like a nudge for that ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions