spring-integration icon indicating copy to clipboard operation
spring-integration copied to clipboard

GatewayProxyBeanRegistrationAotProcessor should not return a CodeFragments

Open snicoll opened this issue 3 years ago • 2 comments

GatewayProxyBeanRegistrationAotProcessor currently returns a custom code fragments but, looking at the code, it does not customize any code generation at all.

If you need to register hints on the state of the BeanFactory, consider implementing BeanFactoryInitializationAotProcessor, see ReflectiveProcessorBeanFactoryInitializationAotProcessor for an example.

snicoll avatar Oct 04 '22 13:10 snicoll

Yeah... I will look into those, Stephane. It was really hard to find how to adapt to the latest Spring AOT changes. At the same time, I really might not deal with the code at all if you confirm that FactoryBean.OBJECT_TYPE_ATTRIBUTE bean definition attribute is propagated by AOT engine. At the moment it is not because of BeanRegistrationCodeGenerator.REJECT_ALL_ATTRIBUTES_FILTER by default. Since my GatewayProxyFactoryBean does not have an explicit type before bean registration phase, I cannot rely on the default type inference algorithm and I definitely need that FactoryBean.OBJECT_TYPE_ATTRIBUTE to be present in bean definition.

Thank you!

artembilan avatar Oct 04 '22 13:10 artembilan

I did miss that the current code actually customizes code generation so the original reason for me opening this issue no longer holds. The issue can either be closed or rephrased to mention that Spring Integration shouldn't be customizing code generation for this use case.

snicoll avatar Oct 05 '22 06:10 snicoll