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
This commit is contained in:
@@ -40,9 +40,9 @@ import org.springframework.context.SmartLifecycle;
|
||||
import org.springframework.core.DecoratingProxy;
|
||||
import org.springframework.integration.context.IntegrationContextUtils;
|
||||
import org.springframework.integration.core.GenericSelector;
|
||||
import org.springframework.integration.core.Pausable;
|
||||
import org.springframework.integration.dsl.IntegrationFlow;
|
||||
import org.springframework.integration.gateway.MethodArgsHolder;
|
||||
import org.springframework.integration.gateway.RequestReplyExchanger;
|
||||
import org.springframework.integration.handler.AbstractReplyProducingMessageHandler;
|
||||
import org.springframework.integration.handler.DelayHandler;
|
||||
import org.springframework.integration.handler.GenericHandler;
|
||||
@@ -55,7 +55,6 @@ import org.springframework.integration.store.MessageHolder;
|
||||
import org.springframework.integration.store.MessageMetadata;
|
||||
import org.springframework.integration.support.MutableMessage;
|
||||
import org.springframework.integration.support.MutableMessageHeaders;
|
||||
import org.springframework.integration.support.management.ManageableSmartLifecycle;
|
||||
import org.springframework.integration.transformer.GenericTransformer;
|
||||
import org.springframework.messaging.MessageHeaders;
|
||||
import org.springframework.messaging.support.ErrorMessage;
|
||||
@@ -83,9 +82,7 @@ class CoreRuntimeHints implements RuntimeHintsRegistrar {
|
||||
IntegrationContextUtils.class,
|
||||
MethodArgsHolder.class,
|
||||
AbstractReplyProducingMessageHandler.RequestHandler.class,
|
||||
ExpressionEvaluatingRoutingSlipRouteStrategy.RequestAndReply.class,
|
||||
Pausable.class,
|
||||
ManageableSmartLifecycle.class)
|
||||
ExpressionEvaluatingRoutingSlipRouteStrategy.RequestAndReply.class)
|
||||
.forEach(type ->
|
||||
reflectionHints.registerType(type,
|
||||
builder -> builder.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS)));
|
||||
@@ -137,6 +134,7 @@ class CoreRuntimeHints implements RuntimeHintsRegistrar {
|
||||
|
||||
ProxyHints proxyHints = hints.proxies();
|
||||
|
||||
registerSpringJdkProxy(proxyHints, RequestReplyExchanger.class);
|
||||
registerSpringJdkProxy(proxyHints, AbstractReplyProducingMessageHandler.RequestHandler.class);
|
||||
registerSpringJdkProxy(proxyHints, IntegrationFlow.class, SmartLifecycle.class);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.integration.core;
|
||||
|
||||
import org.springframework.aot.hint.annotation.Reflective;
|
||||
import org.springframework.integration.support.management.ManageableLifecycle;
|
||||
import org.springframework.jmx.export.annotation.ManagedAttribute;
|
||||
import org.springframework.jmx.export.annotation.ManagedOperation;
|
||||
@@ -26,6 +27,8 @@ import org.springframework.jmx.export.annotation.ManagedOperation;
|
||||
* messages.
|
||||
*
|
||||
* @author Gary Russell
|
||||
* @author Artem Bilan
|
||||
*
|
||||
* @since 5.0.3
|
||||
*
|
||||
*/
|
||||
@@ -35,12 +38,14 @@ public interface Pausable extends ManageableLifecycle {
|
||||
* Pause the endpoint.
|
||||
*/
|
||||
@ManagedOperation(description = "Pause the component")
|
||||
@Reflective
|
||||
void pause();
|
||||
|
||||
/**
|
||||
* Resume the endpoint if paused.
|
||||
*/
|
||||
@ManagedOperation(description = "Resume the component")
|
||||
@Reflective
|
||||
void resume();
|
||||
|
||||
/**
|
||||
@@ -49,6 +54,7 @@ public interface Pausable extends ManageableLifecycle {
|
||||
* @since 5.4
|
||||
*/
|
||||
@ManagedAttribute(description = "Is the component paused?")
|
||||
@Reflective
|
||||
default boolean isPaused() {
|
||||
throw new UnsupportedOperationException("This component does not implement this method");
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.integration.support.management;
|
||||
|
||||
import org.springframework.aot.hint.annotation.Reflective;
|
||||
import org.springframework.context.Lifecycle;
|
||||
import org.springframework.jmx.export.annotation.ManagedAttribute;
|
||||
import org.springframework.jmx.export.annotation.ManagedOperation;
|
||||
@@ -24,20 +25,25 @@ import org.springframework.jmx.export.annotation.ManagedOperation;
|
||||
* Makes {@link Lifecycle} methods manageable.
|
||||
*
|
||||
* @author Gary Russell
|
||||
* @author Artem Bilan
|
||||
*
|
||||
* @since 5.4
|
||||
*
|
||||
*/
|
||||
public interface ManageableLifecycle extends Lifecycle {
|
||||
|
||||
@ManagedOperation(description = "Start the component")
|
||||
@Reflective
|
||||
@Override
|
||||
void start();
|
||||
|
||||
@ManagedOperation(description = "Stop the component")
|
||||
@Reflective
|
||||
@Override
|
||||
void stop();
|
||||
|
||||
@ManagedAttribute(description = "Is the component running?")
|
||||
@Reflective
|
||||
@Override
|
||||
boolean isRunning();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user