Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.

Commit 0c3716f

Browse files
committed
* Add reflection info for AbstractEndpoint to satisfy Control Bus requirements
* Add some common types to satisfy common SpEL expressions
1 parent c146df8 commit 0c3716f

File tree

1 file changed

+42
-1
lines changed

1 file changed

+42
-1
lines changed

spring-native-configuration/src/main/java/org/springframework/integration/IntegrationHints.java

+42-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.springframework.nativex.hint.JdkProxyHint;
2828
import org.springframework.nativex.hint.ResourceHint;
2929
import org.springframework.nativex.hint.TypeHint;
30+
import org.springframework.nativex.type.AccessDescriptor;
3031
import org.springframework.nativex.type.HintDeclaration;
3132
import org.springframework.nativex.type.NativeConfiguration;
3233
import org.springframework.nativex.type.TypeProcessor;
@@ -78,7 +79,10 @@
7879
types = {
7980
org.springframework.integration.xml.xpath.XPathUtils.class,
8081
org.springframework.integration.json.JsonPathUtils.class,
81-
com.jayway.jsonpath.JsonPath.class
82+
com.jayway.jsonpath.JsonPath.class,
83+
org.springframework.integration.gateway.MethodArgsHolder.class,
84+
org.springframework.integration.routingslip.ExpressionEvaluatingRoutingSlipRouteStrategy.RequestAndReply.class,
85+
org.springframework.integration.core.Pausable.class
8286
})
8387
},
8488
jdkProxies = {
@@ -152,15 +156,24 @@ public class IntegrationHints implements NativeConfiguration {
152156
private static final String MESSAGING_GATEWAY_ANNOTATION =
153157
"Lorg/springframework/integration/annotation/MessagingGateway;";
154158

159+
private static final String ABSTRACT_ENDPOINT_TYPE = "Lorg/springframework/integration/endpoint/AbstractEndpoint;";
160+
161+
private static final String MESSAGE_TYPE = "org/springframework/messaging/Message";
162+
155163
@Override
156164
public List<HintDeclaration> computeHints(TypeSystem typeSystem) {
157165
List<HintDeclaration> hints = new ArrayList<>();
158166
hints.addAll(computeMessagingGatewayHints(typeSystem));
167+
hints.addAll(computeAbstractEndpointHints(typeSystem));
168+
// hints.addAll(computeMessageHints(typeSystem));
159169
return hints;
160170
}
161171

162172
private static List<HintDeclaration> computeMessagingGatewayHints(TypeSystem typeSystem) {
163173
return TypeProcessor.namedProcessor("IntegrationHints - MessagingGateway")
174+
.skipMethodInspection()
175+
.skipFieldInspection()
176+
.skipConstructorInspection()
164177
.filter(type ->
165178
type.hasAnnotationInHierarchy(MESSAGING_GATEWAY_ANNOTATION) &&
166179
type.isInterface() &&
@@ -174,4 +187,32 @@ private static List<HintDeclaration> computeMessagingGatewayHints(TypeSystem typ
174187
.processTypes();
175188
}
176189

190+
private static List<HintDeclaration> computeAbstractEndpointHints(TypeSystem typeSystem) {
191+
return TypeProcessor.namedProcessor("IntegrationHints - AbstractEndpoint")
192+
.skipAnnotationInspection()
193+
.skipMethodInspection()
194+
.skipFieldInspection()
195+
.skipConstructorInspection()
196+
.filter(type -> type.extendsClass(ABSTRACT_ENDPOINT_TYPE))
197+
.onTypeDiscovered((type, context) ->
198+
context.addReflectiveAccess(type,
199+
new AccessDescriptor(AccessBits.CLASS | AccessBits.PUBLIC_METHODS)))
200+
.use(typeSystem)
201+
.processTypes();
202+
}
203+
204+
/* private static List<HintDeclaration> computeMessageHints(TypeSystem typeSystem) {
205+
return TypeProcessor.namedProcessor("IntegrationHints - Message")
206+
.skipAnnotationInspection()
207+
.skipMethodInspection()
208+
.skipFieldInspection()
209+
.skipConstructorInspection()
210+
.filter(type -> type.implementsInterface(MESSAGE_TYPE))
211+
.onTypeDiscovered((type, context) ->
212+
context.addReflectiveAccess(type,
213+
new AccessDescriptor(AccessBits.CLASS | AccessBits.PUBLIC_METHODS)))
214+
.use(typeSystem)
215+
.processTypes();
216+
}*/
217+
177218
}

0 commit comments

Comments
 (0)