Skip to content

EventListener in DelegatingEventExternalizer could not be created #973

Open
@paulharkink

Description

@paulharkink

When using Spring Modulith 1.2.5 (starter + events-core + events-kafka) with Spring Boot 3.3.5, the auto-configured DelegatingEventExternalizer instance 'kafkaEventExternalizer' appears to be created as a JdkProxy, which the EventListenerMethodProcessor can not find the @ApplicationModuleListener annotated method on, resulting in the following stacktrace:

org.springframework.beans.factory.BeanInitializationException: Failed to process @EventListener annotation on bean with name 'kafkaEventExternalizer': Need to invoke method 'externalize' declared on target class 'DelegatingEventExternalizer', but not found in any interface(s) of the exposed proxy type. Either pull the method up to an interface or switch to CGLIB proxies by enforcing proxy-target-class mode in your configuration.
	at org.springframework.context.event.EventListenerMethodProcessor.afterSingletonsInstantiated(EventListenerMethodProcessor.java:150)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:986)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:971)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:625)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:335)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1363)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1352)
	...
Caused by: java.lang.IllegalStateException: Need to invoke method 'externalize' declared on target class 'DelegatingEventExternalizer', but not found in any interface(s) of the exposed proxy type. Either pull the method up to an interface or switch to CGLIB proxies by enforcing proxy-target-class mode in your configuration.
	at org.springframework.core.MethodIntrospector.selectInvocableMethod(MethodIntrospector.java:135)
	at org.springframework.aop.support.AopUtils.selectInvocableMethod(AopUtils.java:146)
	at org.springframework.context.event.EventListenerMethodProcessor.processBean(EventListenerMethodProcessor.java:190)
	at org.springframework.context.event.EventListenerMethodProcessor.afterSingletonsInstantiated(EventListenerMethodProcessor.java:146)

I'll be glad to provide additional details as required!
This might very well be user error and not an actual bug, especially since this is the first interaction any of our team has had with Spring Modulith - but I could not find anything out of place. My apologies in advance

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions