Skip to content

Commit e2a5b7d

Browse files
committed
Improve AOT hints code
1 parent 47cfae9 commit e2a5b7d

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

spring-integration-core/src/main/java/org/springframework/integration/aot/CoreRuntimeHints.java

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
import java.util.function.Supplier;
2727
import java.util.stream.Stream;
2828

29-
import org.springframework.aop.SpringProxy;
30-
import org.springframework.aop.framework.Advised;
29+
import org.springframework.aop.framework.AopProxyUtils;
3130
import org.springframework.aot.hint.MemberCategory;
3231
import org.springframework.aot.hint.ProxyHints;
3332
import org.springframework.aot.hint.ReflectionHints;
@@ -37,9 +36,9 @@
3736
import org.springframework.aot.hint.TypeReference;
3837
import org.springframework.beans.factory.config.BeanExpressionContext;
3938
import org.springframework.context.SmartLifecycle;
40-
import org.springframework.core.DecoratingProxy;
4139
import org.springframework.integration.aggregator.MessageGroupProcessor;
4240
import org.springframework.integration.context.IntegrationContextUtils;
41+
import org.springframework.integration.context.IntegrationProperties;
4342
import org.springframework.integration.core.GenericSelector;
4443
import org.springframework.integration.core.MessageSource;
4544
import org.springframework.integration.dsl.IntegrationFlow;
@@ -84,12 +83,11 @@ public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
8483
Supplier.class,
8584
BeanExpressionContext.class,
8685
IntegrationContextUtils.class,
86+
IntegrationProperties.class,
8787
MethodArgsHolder.class,
8888
AbstractReplyProducingMessageHandler.RequestHandler.class,
8989
ExpressionEvaluatingRoutingSlipRouteStrategy.RequestAndReply.class)
90-
.forEach(type ->
91-
reflectionHints.registerType(type,
92-
builder -> builder.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS)));
90+
.forEach(type -> reflectionHints.registerType(type, MemberCategory.INVOKE_PUBLIC_METHODS));
9391

9492
reflectionHints.registerType(JsonPathUtils.class,
9593
builder ->
@@ -98,15 +96,14 @@ public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
9896

9997
// For #xpath() SpEL function
10098
reflectionHints.registerTypeIfPresent(classLoader, "org.springframework.integration.xml.xpath.XPathUtils",
101-
builder -> builder.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS));
99+
MemberCategory.INVOKE_PUBLIC_METHODS);
102100

103101
Stream.of(
104102
"kotlin.jvm.functions.Function0",
105103
"kotlin.jvm.functions.Function1",
106104
"kotlin.Unit")
107105
.forEach(type ->
108-
reflectionHints.registerTypeIfPresent(classLoader, type,
109-
builder -> builder.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS)));
106+
reflectionHints.registerTypeIfPresent(classLoader, type, MemberCategory.INVOKE_PUBLIC_METHODS));
110107

111108
hints.resources().registerPattern("META-INF/spring.integration.properties");
112109

@@ -148,10 +145,7 @@ public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
148145
}
149146

150147
private static void registerSpringJdkProxy(ProxyHints proxyHints, Class<?>... proxiedInterfaces) {
151-
proxyHints
152-
.registerJdkProxy(builder ->
153-
builder.proxiedInterfaces(proxiedInterfaces)
154-
.proxiedInterfaces(SpringProxy.class, Advised.class, DecoratingProxy.class));
148+
proxyHints.registerJdkProxy(AopProxyUtils.completeJdkProxyInterfaces(proxiedInterfaces));
155149
}
156150

157151
}

spring-integration-http/src/main/java/org/springframework/integration/http/aot/HttpRuntimeHints.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ class HttpRuntimeHints implements RuntimeHintsRegistrar {
3636
@Override
3737
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
3838
ReflectionHints reflectionHints = hints.reflection();
39-
reflectionHints.registerType(WebHandler.class, builder ->
40-
builder.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS));
39+
reflectionHints.registerType(WebHandler.class, MemberCategory.INVOKE_PUBLIC_METHODS);
4140

4241
reflectionHints.registerType(HttpRequestHandler.class, builder ->
4342
builder.onReachableType(TypeReference.of("jakarta.servlet.http.HttpServletRequest"))

0 commit comments

Comments
 (0)