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

GH-3828: Initial Spring AOT support

Open artembilan opened this issue 3 years ago • 4 comments

Fixes https://github.com/spring-projects/spring-integration/issues/3828

  • Provide an infrastructure based on a new Spring AOT engine in the latest Spring Framework
  • Introduce RuntimeHintsRegistrar impls into modules which require some reflection, resources or proxies and serialization available in the native image
  • Mark some framework method with the @Reflective to make their reflection info available in the native image, for example for SpEL or JMX invocations
  • Add a GatewayProxyBeanRegistrationAotProcessor to register proxy interfaces info for messaging gateways (either instance of the GatewayProxyFactoryBean)
  • Rework ConverterRegistrar to not use a beanFactory.getBeansWithAnnotation() since it is not available after AOT phase. Instead, register an intermediate IntegrationConverterRegistration bean definition from the IntegrationConverterInitializer
  • Refactor GlobalChannelInterceptorInitializer a bit according to a new logic in the IntegrationConverterInitializer
  • Remove JsonNodeWrapperToJsonNodeConverter bean registration from the DefaultConfiguringBeanFactoryPostProcessor - it is added by the ConverterRegistrar into the target ConversionService
  • Fix ParentContextTests respectively a JsonNodeWrapperToJsonNodeConverter bean removal
  • Refactor XsltPayloadTransformer to not load a ServletContextResource, but just use its name for the xslResource condition

artembilan avatar Jul 02 '22 19:07 artembilan

@mhalbritter, FYI.

Would be great if you review this and leave some your feedback.

I tested the solution against the mentioned integration application in Spring Native at sb-3.0.x branch. It works well without Spring Data. Its failure, though, is not relevant to Spring Integration: Spring Data team investigates some effort for inner bean with Spring AOT. Perhaps I will need more serialization hints when my GenericJackson2JsonRedisSerializer is available with Spring Data fix. But this one can simply go to the next PR/commit.

Thanks

artembilan avatar Jul 02 '22 19:07 artembilan

Hey @artembilan,

i've looked at the code and left some comments. I can't tell if the bean factory stuff is fine, as I don't have enough knowledge in Spring Integration / Spring Framework internals yet. Maybe asking for review from one of the more experienced colleagues helps :)

mhalbritter avatar Jul 05 '22 11:07 mhalbritter

@sdeleuze , @mhalbritter , @snicoll ,

it looks like I have answered for all your questions and we have some plan going forward in the https://github.com/spring-projects/spring-integration/issues/3844. Is there anything what keeps us from merging this?

Thanks

artembilan avatar Jul 14 '22 14:07 artembilan

Fine for me.

mhalbritter avatar Jul 19 '22 14:07 mhalbritter

This is ready for review and possibly merge. The PR for spring-aot-smoke-tests project is follow up.

artembilan avatar Aug 31 '22 16:08 artembilan