AOT hints issue when @Aggregate w/ @AggregateMember

Hello,

I bumped on following AOT hints issue, when app compiled as native image manage Aggregate containing @AggregateMembers:

Caused by: org.axonframework.common.AxonConfigurationException: Failed to instantiate ForwardingMode of type [class org.axonframework.modelling.command.ForwardMatchingInstances].
        at org.axonframework.modelling.command.inspection.AbstractChildEntityDefinition.instantiateForwardingMode(AbstractChildEntityDefinition.java:119)
        at org.axonframework.modelling.command.inspection.AbstractChildEntityDefinition.createChildDefinition(AbstractChildEntityDefinition.java:62)
        at org.axonframework.modelling.command.inspection.AnnotatedAggregateMetaModelFactory$AnnotatedAggregateModel.lambda$createChildDefinitions$16(AnnotatedAggregateMetaModelFactory.java:416)

My environment is:

  • Spring Boot 3.3.5
  • Axon Framework 4.9.1

After some debugging I managed to resolve the issue by adding following AOT hint in my project:

{
    "name":"org.axonframework.modelling.command.ForwardMatchingInstances",
    "methods":[{"name":"<init>","parameterTypes":[] }]
  },

Of course I’ll need to add other ForwardingMode classes if I need to use them. My approach is temporary and not durable on Axon’s API changes.

In any case I’m expecting this and all other axon framework specific AOT hints to be handled by the extension-spring-aot.

Cheers,
Paco

A pull request has been created to address this issue: