Skip to content

Commit 8c9662a

Browse files
committed
Expose more AOT hints
* Add `@Reflective` to methods of `Pausable` and `ManageableLifecycle` to give them access from Control Bus which uses SpEL invocation engine - reflection, essentially * Add proxy hint for the `RequestReplyExchanger`, which is used for `gateway()` definition in Java DSL
1 parent 5080fc2 commit 8c9662a

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@
4040
import org.springframework.core.DecoratingProxy;
4141
import org.springframework.integration.context.IntegrationContextUtils;
4242
import org.springframework.integration.core.GenericSelector;
43-
import org.springframework.integration.core.Pausable;
4443
import org.springframework.integration.dsl.IntegrationFlow;
4544
import org.springframework.integration.gateway.MethodArgsHolder;
45+
import org.springframework.integration.gateway.RequestReplyExchanger;
4646
import org.springframework.integration.handler.AbstractReplyProducingMessageHandler;
4747
import org.springframework.integration.handler.DelayHandler;
4848
import org.springframework.integration.handler.GenericHandler;
@@ -55,7 +55,6 @@
5555
import org.springframework.integration.store.MessageMetadata;
5656
import org.springframework.integration.support.MutableMessage;
5757
import org.springframework.integration.support.MutableMessageHeaders;
58-
import org.springframework.integration.support.management.ManageableSmartLifecycle;
5958
import org.springframework.integration.transformer.GenericTransformer;
6059
import org.springframework.messaging.MessageHeaders;
6160
import org.springframework.messaging.support.ErrorMessage;
@@ -83,9 +82,7 @@ public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
8382
IntegrationContextUtils.class,
8483
MethodArgsHolder.class,
8584
AbstractReplyProducingMessageHandler.RequestHandler.class,
86-
ExpressionEvaluatingRoutingSlipRouteStrategy.RequestAndReply.class,
87-
Pausable.class,
88-
ManageableSmartLifecycle.class)
85+
ExpressionEvaluatingRoutingSlipRouteStrategy.RequestAndReply.class)
8986
.forEach(type ->
9087
reflectionHints.registerType(type,
9188
builder -> builder.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS)));
@@ -137,6 +134,7 @@ public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
137134

138135
ProxyHints proxyHints = hints.proxies();
139136

137+
registerSpringJdkProxy(proxyHints, RequestReplyExchanger.class);
140138
registerSpringJdkProxy(proxyHints, AbstractReplyProducingMessageHandler.RequestHandler.class);
141139
registerSpringJdkProxy(proxyHints, IntegrationFlow.class, SmartLifecycle.class);
142140
}

spring-integration-core/src/main/java/org/springframework/integration/core/Pausable.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package org.springframework.integration.core;
1818

19+
import org.springframework.aot.hint.annotation.Reflective;
1920
import org.springframework.integration.support.management.ManageableLifecycle;
2021
import org.springframework.jmx.export.annotation.ManagedAttribute;
2122
import org.springframework.jmx.export.annotation.ManagedOperation;
@@ -26,6 +27,8 @@
2627
* messages.
2728
*
2829
* @author Gary Russell
30+
* @author Artem Bilan
31+
*
2932
* @since 5.0.3
3033
*
3134
*/
@@ -35,12 +38,14 @@ public interface Pausable extends ManageableLifecycle {
3538
* Pause the endpoint.
3639
*/
3740
@ManagedOperation(description = "Pause the component")
41+
@Reflective
3842
void pause();
3943

4044
/**
4145
* Resume the endpoint if paused.
4246
*/
4347
@ManagedOperation(description = "Resume the component")
48+
@Reflective
4449
void resume();
4550

4651
/**
@@ -49,6 +54,7 @@ public interface Pausable extends ManageableLifecycle {
4954
* @since 5.4
5055
*/
5156
@ManagedAttribute(description = "Is the component paused?")
57+
@Reflective
5258
default boolean isPaused() {
5359
throw new UnsupportedOperationException("This component does not implement this method");
5460
}

spring-integration-core/src/main/java/org/springframework/integration/support/management/ManageableLifecycle.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package org.springframework.integration.support.management;
1818

19+
import org.springframework.aot.hint.annotation.Reflective;
1920
import org.springframework.context.Lifecycle;
2021
import org.springframework.jmx.export.annotation.ManagedAttribute;
2122
import org.springframework.jmx.export.annotation.ManagedOperation;
@@ -24,20 +25,25 @@
2425
* Makes {@link Lifecycle} methods manageable.
2526
*
2627
* @author Gary Russell
28+
* @author Artem Bilan
29+
*
2730
* @since 5.4
2831
*
2932
*/
3033
public interface ManageableLifecycle extends Lifecycle {
3134

3235
@ManagedOperation(description = "Start the component")
36+
@Reflective
3337
@Override
3438
void start();
3539

3640
@ManagedOperation(description = "Stop the component")
41+
@Reflective
3742
@Override
3843
void stop();
3944

4045
@ManagedAttribute(description = "Is the component running?")
46+
@Reflective
4147
@Override
4248
boolean isRunning();
4349

0 commit comments

Comments
 (0)