Skip to content

MessagingAnnotationBeanPostProcessor: Code generation does not support org.springframework.beans.factory.support.DefaultListableBeanFactory #8703

Closed
@mmoayyed

Description

@mmoayyed

In what version(s) of Spring Integration are you seeing this issue?

6.2.0-M1

Describe the bug

During AOT processing, the Gradle processAot fails with the following:

Caused by: java.lang.IllegalArgumentException: Code generation does not support org.springframework.beans.factory.support.DefaultListableBeanFactory
        at org.springframework.beans.factory.aot.BeanDefinitionPropertyValueCodeGenerator.generateCode(BeanDefinitionPropertyValueCodeGenerator.java:134)
        at org.springframework.beans.factory.aot.BeanDefinitionPropertyValueCodeGenerator.generateCode(BeanDefinitionPropertyValueCodeGenerator.java:99)
        ... 31 more

While debugging through the call stack, I can see the bean definition that is being processed is MessagingAnnotationBeanPostProcessor and it contains the following constructor:

public MessagingAnnotationBeanPostProcessor(BeanDefinitionRegistry registry,
			Map<Class<? extends Annotation>, MethodAnnotationPostProcessor<?>> postProcessors) {

		this.registry = registry;
		this.postProcessors = postProcessors;
}

The stacktrace shows:

        at org.springframework.beans.factory.aot.BeanDefinitionPropertyValueCodeGenerator.generateCode(BeanDefinitionPropertyValueCodeGenerator.java:102)
        at org.springframework.beans.factory.aot.BeanDefinitionPropertiesCodeGenerator.generateValue(BeanDefinitionPropertiesCodeGenerator.java:220)
        at org.springframework.beans.factory.aot.BeanDefinitionPropertiesCodeGenerator.lambda$addConstructorArgumentValues$3(BeanDefinitionPropertiesCodeGenerator.java:171)
        at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:986)
        at java.base/java.util.Collections$UnmodifiableMap.forEach(Collections.java:1707)
        at org.springframework.beans.factory.aot.BeanDefinitionPropertiesCodeGenerator.addConstructorArgumentValues(BeanDefinitionPropertiesCodeGenerator.java:170)

Debugger shows that when calling addConstructorArgumentValues, the constructor argument BeanDefinitionRegistry registry eventually leads to this error.

To Reproduce

./gradlew clean build with Spring Boot 3.2 M1 and 6.2.0-M1.

Expected behavior

AOT build should complete successfully

Sample

Related issue: #8571

I'll put together a sample next.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions