Axonframework: spring-boot-starter: EventProcessingAutoConfiguration cannot be enhanced by bean postprocessor

Created on 16 Oct 2019  路  7Comments  路  Source: AxonFramework/AxonFramework

Starting a spring boot app using the axon-spring-boot-starter:4.2 I see the following log entry (INFO):

Cannot enhance @Configuration bean definition 'org.axonframework.springboot.autoconfig.EventProcessingAutoConfiguration' 
since its singleton instance has been created too early. The typical cause is 
a non-static @Bean method with a BeanDefinitionRegistryPostProcessor 
return type: Consider declaring such methods as 'static'.

Didn't relly dug into this, but maybe it's worth following the consideration advice.

Won't Fix

All 7 comments

Hi @jangalinski, we had a discussion about this a while back with the team. We're going to need to significantly redesign the way autoconfiguration is currently done. This notice is one of the side-effects of the current structure. Fortunately, it doesn't have any other significant impact, as far as we know.

I see, thanks for the info ...will ignore it.

Hi @abuijze,

I'm experiencing this error while running a spring boot application with axon server. The handlers doesn't seem to be registered.

org.axonframework.commandhandling.NoHandlerForCommandException: No Handler for command: com.fundev.adt.coreapi.CommandPatientCreate
    at org.axonframework.axonserver.connector.ErrorCode.lambda$static$9(ErrorCode.java:81) ~[axon-server-connector-4.2.1.jar:4.2.1]
    at org.axonframework.axonserver.connector.ErrorCode.convert(ErrorCode.java:182) ~[axon-server-connector-4.2.1.jar:4.2.1]
    at org.axonframework.axonserver.connector.command.CommandSerializer.deserialize(CommandSerializer.java:157) ~[axon-server-connector-4.2.1.jar:4.2.1]
    at org.axonframework.axonserver.connector.command.AxonServerCommandBus$1.onNext(AxonServerCommandBus.java:294) ~[axon-server-connector-4.2.1.jar:4.2.1]
    at org.axonframework.axonserver.connector.command.AxonServerCommandBus$1.onNext(AxonServerCommandBus.java:286) ~[axon-server-connector-4.2.1.jar:4.2.1]
    at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onMessage(ClientCalls.java:429) ~[grpc-stub-1.22.1.jar:1.22.1]
    at io.grpc.ForwardingClientCallListener.onMessage(ForwardingClientCallListener.java:33) ~[grpc-api-1.22.1.jar:1.22.1]
    at io.grpc.ForwardingClientCallListener.onMessage(ForwardingClientCallListener.java:33) ~[grpc-api-1.22.1.jar:1.22.1]
    at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1MessagesAvailable.runInternal(ClientCallImpl.java:596) ~[grpc-core-1.22.1.jar:1.22.1]
    at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1MessagesAvailable.runInContext(ClientCallImpl.java:581) ~[grpc-core-1.22.1.jar:1.22.1]
    at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) ~[grpc-core-1.22.1.jar:1.22.1]
    at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123) ~[grpc-core-1.22.1.jar:1.22.1]
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
    at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]

This is preceded by

2020-12-18 14:11:58.838  INFO 8778 --- [  restartedMain] o.s.c.a.ConfigurationClassPostProcessor  : Cannot enhance @Configuration bean definition 'org.axonframework.springboot.autoconfig.EventProcessingAutoConfiguration' since its singleton instance has been created too early. The typical cause is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'.
2020-12-18 14:11:58.999  INFO 8778 --- [  restartedMain] trationDelegate$BeanPostProcessorChecker : Bean '__axon-parameter-resolver-factory' of type [org.axonframework.spring.config.ApplicationContextLookupParameterResolverFactory] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-12-18 14:11:59.000  INFO 8778 --- [  restartedMain] trationDelegate$BeanPostProcessorChecker : Bean '__axon-parameter-resolver-factory' of type [org.axonframework.messaging.annotation.MultiParameterResolverFactory] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-12-18 14:11:59.010  INFO 8778 --- [  restartedMain] trationDelegate$BeanPostProcessorChecker : Bean '(inner bean)#295f6daa' of type [org.axonframework.spring.config.annotation.SpringHandlerDefinitionBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-12-18 14:11:59.011  INFO 8778 --- [  restartedMain] trationDelegate$BeanPostProcessorChecker : Bean '(inner bean)#295f6daa' of type [org.axonframework.messaging.annotation.MultiHandlerDefinition] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-12-18 14:11:59.011  INFO 8778 --- [  restartedMain] trationDelegate$BeanPostProcessorChecker : Bean '(inner bean)#2fc30079' of type [org.axonframework.spring.config.annotation.SpringHandlerEnhancerDefinitionBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-12-18 14:11:59.012  INFO 8778 --- [  restartedMain] trationDelegate$BeanPostProcessorChecker : Bean '(inner bean)#2fc30079' of type [org.axonframework.messaging.annotation.MultiHandlerEnhancerDefinition] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-12-18 14:11:59.014  INFO 8778 --- [  restartedMain] trationDelegate$BeanPostProcessorChecker : Bean '__axon-handler-definition' of type [org.axonframework.messaging.annotation.MultiHandlerDefinition] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

Does it mean that the autoconfiguration of the commandBus with the commandHandlers is not working and I should do it manually or is not a related problem?

Thanks

Sorry my error hasn't nothing to do with this issue thread.

I was using the @Profile("command") annotation together with the @Aggregate annotation and this cause my commandHandler to be undiscoverable by Axon Server.

Suggestion
I don't know what are the implications but I think should be noted somewhere. I lost too many hours on this :/.

Troublesome to hear you wasted some cycles on this @gpietro... However, I am unsure how the framework could've clarified things further for you that there were no handlers assigned at all.

Only thing I can think of is turn on debug logging to see the handlers being registered really. It is perfectly fine for an application/component not to have any message handling functions really, as all they could do is dispatch messages for example.

I do notice that some of our CommandBus implementations don't (debug) log the fact a command handler is being registered. The AxonServerCommandBus does though, which I note you are using, so that part should be covered. Regardless, debug logging in the other instances couldn't hurt I wager, so I'll add that.

Maybe is something more related to axon-spring-boot-start but for me is not clear why the @Profile annotation compromise the command/query handler auto discovery.

_Btw. I'm not an experienced Spring developer (I'm more into js) so I apologize if my misunderstanding is due to a lack of knowledge on how Spring annotations works._

Gotcha, let me explain the profile workings a little bit.

The @Profile([my-profile]) annotation is used to define that a given component (class meta-annotated with @Component) should only be created if [my-profile] is active.

The @Aggregate annotation in Axon is meta-annotated with @Component for one. This means that if you run an application which uses Axon's @Aggregate annotation to mark a class as an Aggregate, and you are using Spring profiles, then the aggregate would only ever be created if the said profile is active.

None of this is Axon specific as you might have noticed from my answer. Hence why I wasn't really sure how Axon can solve this problem for you to begin with.

What might prove useful is you are just starting with Axon, is to check ou the Reference Guide. If after that you happen to have any usage questions, it would be best to drop those on our forum.

Was this page helpful?
0 / 5 - 0 ratings