GH-3828: Initial Spring AOT support (#3832)
* GH-3828: Initial Spring AOT support 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 * * Rework AOT support according latest changes and requirements * Remove `@Bean` reflection since it is not needed any more * Add `AotDetector.useGeneratedArtifacts()` condition to not register beans one more time at runtime after AOT build phase * Fix deprecation in the WebFlux test from the latest SF
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -110,24 +110,6 @@ public class XsltPayloadTransformer extends AbstractXmlTransformer implements Be
|
||||
|
||||
private String[] xsltParamHeaders;
|
||||
|
||||
private static final Class<?> SERVLET_CONTEXT_RESOURCE_CLASS;
|
||||
|
||||
static {
|
||||
Class<?> aClass = null;
|
||||
try {
|
||||
aClass =
|
||||
ClassUtils.forName("org.springframework.web.context.support.ServletContextResource",
|
||||
ClassUtils.getDefaultClassLoader());
|
||||
}
|
||||
|
||||
catch (ClassNotFoundException e) {
|
||||
// No 'ServletContextResource' class present - ignoring
|
||||
}
|
||||
finally {
|
||||
SERVLET_CONTEXT_RESOURCE_CLASS = aClass;
|
||||
}
|
||||
}
|
||||
|
||||
public XsltPayloadTransformer(Templates templates) {
|
||||
this(templates, null);
|
||||
}
|
||||
@@ -160,8 +142,8 @@ public class XsltPayloadTransformer extends AbstractXmlTransformer implements Be
|
||||
Assert.isTrue(xslResource instanceof ClassPathResource ||
|
||||
xslResource instanceof FileSystemResource ||
|
||||
xslResource instanceof VfsResource || // NOSONAR boolean complexity
|
||||
(SERVLET_CONTEXT_RESOURCE_CLASS != null
|
||||
&& SERVLET_CONTEXT_RESOURCE_CLASS.isInstance(xslResource)),
|
||||
xslResource.getClass().getName()
|
||||
.equals("org.springframework.web.context.support.ServletContextResource"),
|
||||
"Only 'ClassPathResource', 'FileSystemResource', 'ServletContextResource' or 'VfsResource'" +
|
||||
" are supported directly in this transformer. For any other 'Resource' implementations" +
|
||||
" consider to use a 'Templates'-based constructor instantiation.");
|
||||
@@ -288,7 +270,7 @@ public class XsltPayloadTransformer extends AbstractXmlTransformer implements Be
|
||||
else {
|
||||
payload = message.getPayload();
|
||||
}
|
||||
Object transformedPayload = null;
|
||||
Object transformedPayload;
|
||||
if (this.alwaysUseResultFactory) {
|
||||
transformedPayload = transformUsingResultFactory(payload, transformer);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user