From d9f21fef423caa2e7c87e56bf1b4ae18236c9038 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Thu, 2 Jan 2025 14:06:31 -0500 Subject: [PATCH] GH-9683: Bring back `controlBus()` API Fixes: https://github.com/spring-projects/spring-integration/issues/9683 Since we don't support SpEL-based Control Bus functionality anymore, there is no need to keep separate `controlBusOnRegistry()` * In all DSLs Deprecate `controlBusOnRegistry()` and restore `controlBus()` which is now fully based on the `ControlBusCommandRegistry` * Deprecate now out of use `` attribute * Fix `ControlBusParser` to not deal with `use-registry` attribute anymore * Remove deprecated before `ExpressionControlBusFactoryBean` and `ExpressionCommandMessageProcessor` * Remove `use-registry` from test configs * Fix `ControlBusChainTests` to rely on a new Control Bus functionality --- .../ExpressionControlBusFactoryBean.java | 59 ------- .../config/xml/ControlBusParser.java | 12 +- .../dsl/BaseIntegrationFlowDefinition.java | 19 +-- .../ExpressionCommandMessageProcessor.java | 150 ------------------ .../dsl/KotlinIntegrationFlowDefinition.kt | 8 +- .../integration/config/spring-integration.xsd | 9 +- ...torWithMessageStoreParserTests-context.xml | 2 +- .../xml/ControlBusChainTests-context.xml | 9 +- .../config/xml/ControlBusChainTests.java | 24 +-- .../ControlBusExplicitPollerTests-context.xml | 2 +- .../xml/ControlBusLifecycleTests-context.xml | 2 +- .../xml/ControlBusPollerTests-context.xml | 2 +- ...rolBusRecipientListRouterTests-context.xml | 2 +- .../config/xml/ControlBusTests-context.xml | 2 +- .../dsl/flows/IntegrationFlowTests.java | 4 +- .../integration/file/dsl/FileTests.java | 4 +- .../GroovyIntegrationFlowDefinition.groovy | 11 +- .../tcp/ClientModeControlBusTests-context.xml | 2 +- .../integration/jms/dsl/JmsTests.java | 4 +- .../jmx/UpdateMappingsTests-context.xml | 2 +- .../config/ControlBusParserTests-context.xml | 2 +- .../monitor/self-destruction-context.xml | 2 +- .../mbeanexporterhelper/INT-2626-config.xml | 2 +- .../antora/modules/ROOT/pages/whats-new.adoc | 3 + 24 files changed, 54 insertions(+), 284 deletions(-) delete mode 100644 spring-integration-core/src/main/java/org/springframework/integration/config/ExpressionControlBusFactoryBean.java delete mode 100644 spring-integration-core/src/main/java/org/springframework/integration/handler/ExpressionCommandMessageProcessor.java diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/ExpressionControlBusFactoryBean.java b/spring-integration-core/src/main/java/org/springframework/integration/config/ExpressionControlBusFactoryBean.java deleted file mode 100644 index f742c94343..0000000000 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/ExpressionControlBusFactoryBean.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2002-2024 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.integration.config; - -import org.springframework.expression.MethodFilter; -import org.springframework.integration.handler.ServiceActivatingHandler; -import org.springframework.messaging.MessageHandler; - -/** - * FactoryBean for creating {@link MessageHandler} instances to handle a message as a SpEL expression. - * - * @author Dave Syer - * @author Mark Fisher - * @author Oleg Zhurakousky - * @author Artem Bilan - * - * @since 2.0 - * - * @deprecated in favor of {@link ControlBusFactoryBean} - */ -@Deprecated(since = "6.4", forRemoval = true) -public class ExpressionControlBusFactoryBean extends AbstractSimpleMessageHandlerFactoryBean { - - @SuppressWarnings("removal") - private static final MethodFilter METHOD_FILTER = new org.springframework.integration.expression.ControlBusMethodFilter(); - - private Long sendTimeout; - - public void setSendTimeout(Long sendTimeout) { - this.sendTimeout = sendTimeout; - } - - @SuppressWarnings("removal") - @Override - protected MessageHandler createHandler() { - org.springframework.integration.handler.ExpressionCommandMessageProcessor processor = - new org.springframework.integration.handler.ExpressionCommandMessageProcessor(METHOD_FILTER, getBeanFactory()); - ServiceActivatingHandler handler = new ServiceActivatingHandler(processor); - if (this.sendTimeout != null) { - handler.setSendTimeout(this.sendTimeout); - } - return handler; - } - -} diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/ControlBusParser.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/ControlBusParser.java index 7cedc96b53..a2dbc6c82d 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/ControlBusParser.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/ControlBusParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2024 the original author or authors. + * Copyright 2002-2025 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. @@ -32,18 +32,8 @@ import org.springframework.integration.config.ControlBusFactoryBean; public class ControlBusParser extends AbstractConsumerEndpointParser { @Override - @SuppressWarnings("removal") protected BeanDefinitionBuilder parseHandler(Element element, ParserContext parserContext) { BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(ControlBusFactoryBean.class); - if (Boolean.FALSE.equals(Boolean.parseBoolean(element.getAttribute("use-registry")))) { - builder = BeanDefinitionBuilder.genericBeanDefinition( - org.springframework.integration.config.ExpressionControlBusFactoryBean.class); - parserContext.getReaderContext() - .warning("The 'ExpressionControlBusFactoryBean' for '' is deprecated (for removal) " + - "in favor of 'ControlBusFactoryBean'. " + - "Set 'use-registry' attribute to 'true' to switch to a new functionality.", - element); - } IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "send-timeout"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "order"); return builder; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/BaseIntegrationFlowDefinition.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/BaseIntegrationFlowDefinition.java index fdfdbd7a2a..8761e12ecc 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/BaseIntegrationFlowDefinition.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/BaseIntegrationFlowDefinition.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2024 the original author or authors. + * Copyright 2019-2025 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. @@ -518,10 +518,12 @@ public abstract class BaseIntegrationFlowDefinition> endpointConfigurer) { - return handle(new ServiceActivatingHandler(new ControlBusMessageProcessor()), endpointConfigurer); + return controlBus(endpointConfigurer); } /** * Populate the {@code Control Bus} EI Pattern specific {@link MessageHandler} implementation * at the current {@link IntegrationFlow} chain position. * @return the current {@link BaseIntegrationFlowDefinition}. - * @deprecated in favor of {@link #controlBusOnRegistry()} - will be restored in next version. */ - @Deprecated(since = "6.4") public B controlBus() { return controlBus(null); } @@ -553,15 +555,10 @@ public abstract class BaseIntegrationFlowDefinition> endpointConfigurer) { - return handle(new ServiceActivatingHandler( - new org.springframework.integration.handler.ExpressionCommandMessageProcessor( - new org.springframework.integration.expression.ControlBusMethodFilter())), endpointConfigurer); + return handle(new ServiceActivatingHandler(new ControlBusMessageProcessor()), endpointConfigurer); } /** diff --git a/spring-integration-core/src/main/java/org/springframework/integration/handler/ExpressionCommandMessageProcessor.java b/spring-integration-core/src/main/java/org/springframework/integration/handler/ExpressionCommandMessageProcessor.java deleted file mode 100644 index bde8b770a0..0000000000 --- a/spring-integration-core/src/main/java/org/springframework/integration/handler/ExpressionCommandMessageProcessor.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright 2002-2024 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.integration.handler; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.springframework.beans.factory.BeanFactory; -import org.springframework.core.convert.TypeDescriptor; -import org.springframework.expression.AccessException; -import org.springframework.expression.EvaluationContext; -import org.springframework.expression.EvaluationException; -import org.springframework.expression.Expression; -import org.springframework.expression.MethodExecutor; -import org.springframework.expression.MethodFilter; -import org.springframework.expression.MethodResolver; -import org.springframework.expression.spel.support.ReflectiveMethodResolver; -import org.springframework.expression.spel.support.StandardEvaluationContext; -import org.springframework.integration.IntegrationPattern; -import org.springframework.integration.IntegrationPatternType; -import org.springframework.lang.Nullable; -import org.springframework.messaging.Message; -import org.springframework.util.CollectionUtils; - -/** - * A MessageProcessor implementation that expects an Expression or expressionString - * as the Message payload. When processing, it simply evaluates that expression. - * - * @author Dave Syer - * @author Mark Fisher - * @author Gary Russell - * @author Artem Bilan - * @author Ngoc Nhan - * - * @since 2.0 - * - * @deprecated in favor of {@link ControlBusMessageProcessor} - */ -@Deprecated(since = "6.4", forRemoval = true) -public class ExpressionCommandMessageProcessor extends AbstractMessageProcessor - implements IntegrationPattern { - - @Nullable - private final MethodFilter methodFilter; - - public ExpressionCommandMessageProcessor() { - this.methodFilter = null; - } - - public ExpressionCommandMessageProcessor(@Nullable MethodFilter methodFilter) { - this(methodFilter, null); - } - - public ExpressionCommandMessageProcessor(@Nullable MethodFilter methodFilter, @Nullable BeanFactory beanFactory) { - this.methodFilter = methodFilter; - if (beanFactory != null) { - setBeanFactory(beanFactory); - } - } - - @Override - public final void setBeanFactory(BeanFactory beanFactory) { - super.setBeanFactory(beanFactory); - if (this.methodFilter != null) { - MethodResolver methodResolver = new ExpressionCommandMethodResolver(this.methodFilter); - if (getEvaluationContext() instanceof StandardEvaluationContext standardEvaluationContext) { - standardEvaluationContext.setMethodResolvers(Collections.singletonList(methodResolver)); - } - else { - logger.warn("Cannot customize the 'SimpleEvaluationContext'"); - } - } - } - - @Override - public IntegrationPatternType getIntegrationPatternType() { - return IntegrationPatternType.control_bus; - } - - /** - * Evaluates the Message payload expression as a command. - * @throws IllegalArgumentException if the payload is not an Exception or String - */ - @Override - @Nullable - public Object processMessage(Message message) { - Object expression = message.getPayload(); - if (expression instanceof Expression) { - return evaluateExpression((Expression) expression, message); - } - if (expression instanceof String) { - return evaluateExpression((String) expression, message); - } - throw new IllegalArgumentException("Message payload must be an Expression instance or an expression String."); - } - - private static final class ExpressionCommandMethodResolver extends ReflectiveMethodResolver { - - private final MethodFilter methodFilter; - - ExpressionCommandMethodResolver(MethodFilter methodFilter) { - this.methodFilter = methodFilter; - } - - @Override - public MethodExecutor resolve(EvaluationContext context, - Object targetObject, String name, List argumentTypes) - throws AccessException { - - validateMethod(targetObject, name, !CollectionUtils.isEmpty(argumentTypes) ? argumentTypes.size() : 0); - return super.resolve(context, targetObject, name, argumentTypes); - } - - private void validateMethod(Object targetObject, String name, int argumentCount) { - Class type = (targetObject instanceof Class ? (Class) targetObject : targetObject.getClass()); - Method[] methods = type.getMethods(); - List candidates = new ArrayList<>(); - for (Method method : methods) { - if (method.getName().equals(name) && method.getParameterTypes().length == argumentCount) { - candidates.add(method); - } - } - List supportedMethods = this.methodFilter.filter(candidates); - if (supportedMethods.isEmpty()) { - String methodDescription = (!candidates.isEmpty()) ? candidates.get(0).toString() : name; - throw new EvaluationException("The method '" + methodDescription + - "' is not supported by this command processor. " + - "If using the Control Bus, consider adding @ManagedOperation or @ManagedAttribute."); - } - } - - } - -} diff --git a/spring-integration-core/src/main/kotlin/org/springframework/integration/dsl/KotlinIntegrationFlowDefinition.kt b/spring-integration-core/src/main/kotlin/org/springframework/integration/dsl/KotlinIntegrationFlowDefinition.kt index 5a049a944d..ab352120b8 100644 --- a/spring-integration-core/src/main/kotlin/org/springframework/integration/dsl/KotlinIntegrationFlowDefinition.kt +++ b/spring-integration-core/src/main/kotlin/org/springframework/integration/dsl/KotlinIntegrationFlowDefinition.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2024 the original author or authors. + * Copyright 2020-2025 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. @@ -285,17 +285,15 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * at the current [IntegrationFlow] chain position. * @since 6.4 */ + @Deprecated("Use 'controlBus()' instead.", replaceWith = ReplaceWith("controlBus()")) fun controlBusOnRegistry(endpointConfigurer: GenericEndpointSpec.() -> Unit = {}) { - this.delegate.controlBusOnRegistry(endpointConfigurer) + controlBus(endpointConfigurer) } /** * Populate the `Control Bus` EI Pattern specific [MessageHandler] implementation * at the current [IntegrationFlow] chain position. */ - @Deprecated("Use 'controlBusOnRegistry()' instead.", - replaceWith = ReplaceWith("controlBusOnRegistry()")) - @Suppress("DEPRECATION", "REMOVAL") fun controlBus(endpointConfigurer: GenericEndpointSpec.() -> Unit = {}) { this.delegate.controlBus(endpointConfigurer) } diff --git a/spring-integration-core/src/main/resources/org/springframework/integration/config/spring-integration.xsd b/spring-integration-core/src/main/resources/org/springframework/integration/config/spring-integration.xsd index 403d1ce6d7..c09309a559 100644 --- a/spring-integration-core/src/main/resources/org/springframework/integration/config/spring-integration.xsd +++ b/spring-integration-core/src/main/resources/org/springframework/integration/config/spring-integration.xsd @@ -4978,13 +4978,12 @@ The list of component name patterns you want to track (e.g., tracked-components ]]> - + - Set true to make Control Bus based on the global 'ControlBusCommandRegistry' - which is a recommended way to configure Control Bus functionality. - The false is by default for backward compatibility and is deprecated. - This attribute will be true by default in the next major version and removed altogether eventually. + [DEPRECATED] + The attribute is out of use since 6.5 and 'ControlBusCommandRegistry' is always configured. + Will be removed in the next version. diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/AggregatorWithMessageStoreParserTests-context.xml b/spring-integration-core/src/test/java/org/springframework/integration/config/AggregatorWithMessageStoreParserTests-context.xml index a1bece4486..d1083dcd6f 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/AggregatorWithMessageStoreParserTests-context.xml +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/AggregatorWithMessageStoreParserTests-context.xml @@ -20,6 +20,6 @@ - + diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusChainTests-context.xml b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusChainTests-context.xml index c6d38a28e7..fee3bcca77 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusChainTests-context.xml +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusChainTests-context.xml @@ -1,7 +1,8 @@ - @@ -14,6 +15,6 @@ - + diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusChainTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusChainTests.java index 8bdd3fa1b6..93e609c07d 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusChainTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusChainTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2024 the original author or authors. + * Copyright 2002-2025 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. @@ -16,17 +16,17 @@ package org.springframework.integration.config.xml; -import java.util.Date; +import java.util.List; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.integration.IntegrationMessageHeaderAccessor; import org.springframework.integration.support.MessageBuilder; import org.springframework.jmx.export.annotation.ManagedOperation; import org.springframework.messaging.Message; import org.springframework.messaging.MessageChannel; import org.springframework.messaging.PollableChannel; -import org.springframework.messaging.support.GenericMessage; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; @@ -47,13 +47,13 @@ public class ControlBusChainTests { private PollableChannel output; @Test - public void testDefaultEvaluationContext() { + public void controlBusInChain() { Message message = - MessageBuilder.withPayload("@service.convert('aardvark')+headers.foo") - .setHeader("foo", "bar") + MessageBuilder.withPayload("service.convert") + .setHeader(IntegrationMessageHeaderAccessor.CONTROL_BUS_ARGUMENTS, List.of("data")) .build(); this.input.send(message); - assertThat(output.receive(0).getPayload()).isEqualTo("catbar"); + assertThat(output.receive(0)).extracting(Message::getPayload).isEqualTo("some data"); assertThat(output.receive(0)).isNull(); } @@ -61,15 +61,7 @@ public class ControlBusChainTests { @ManagedOperation public String convert(String input) { - return "cat"; - } - - } - - public static class AdapterService { - - public Message receive() { - return new GenericMessage<>(new Date().toString()); + return "some " + input; } } diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusExplicitPollerTests-context.xml b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusExplicitPollerTests-context.xml index 2f351a177e..c662a3c1a1 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusExplicitPollerTests-context.xml +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusExplicitPollerTests-context.xml @@ -14,7 +14,7 @@ - + diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusLifecycleTests-context.xml b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusLifecycleTests-context.xml index 7db82494ba..41bdf7368f 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusLifecycleTests-context.xml +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusLifecycleTests-context.xml @@ -7,7 +7,7 @@ https://www.springframework.org/schema/beans/spring-beans.xsd"> - + diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusPollerTests-context.xml b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusPollerTests-context.xml index 2baf9b2a0e..f410c5ed7c 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusPollerTests-context.xml +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusPollerTests-context.xml @@ -14,7 +14,7 @@ - + diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusRecipientListRouterTests-context.xml b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusRecipientListRouterTests-context.xml index dc24af6c4f..6d25f57e47 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusRecipientListRouterTests-context.xml +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusRecipientListRouterTests-context.xml @@ -10,7 +10,7 @@ - + diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusTests-context.xml b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusTests-context.xml index dbb4d2c70c..66987f9b8c 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusTests-context.xml +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusTests-context.xml @@ -15,7 +15,7 @@ - + diff --git a/spring-integration-core/src/test/java/org/springframework/integration/dsl/flows/IntegrationFlowTests.java b/spring-integration-core/src/test/java/org/springframework/integration/dsl/flows/IntegrationFlowTests.java index 6224155d25..4d9765e5cc 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/dsl/flows/IntegrationFlowTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/dsl/flows/IntegrationFlowTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 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. @@ -636,7 +636,7 @@ public class IntegrationFlowTests { @Bean public IntegrationFlow controlBusFlow() { return IntegrationFlow.from(ControlBusGateway.class, (gateway) -> gateway.beanName("controlBusGateway")) - .controlBusOnRegistry((endpoint) -> endpoint.id("controlBus")) + .controlBus((endpoint) -> endpoint.id("controlBus")) .get(); } diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/dsl/FileTests.java b/spring-integration-file/src/test/java/org/springframework/integration/file/dsl/FileTests.java index 3ae75ba605..b10a65dfee 100644 --- a/spring-integration-file/src/test/java/org/springframework/integration/file/dsl/FileTests.java +++ b/spring-integration-file/src/test/java/org/springframework/integration/file/dsl/FileTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 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. @@ -322,7 +322,7 @@ public class FileTests { @Bean public IntegrationFlow controlBus() { - return IntegrationFlowDefinition::controlBusOnRegistry; + return IntegrationFlowDefinition::controlBus; } @Bean diff --git a/spring-integration-groovy/src/main/groovy/org/springframework/integration/groovy/dsl/GroovyIntegrationFlowDefinition.groovy b/spring-integration-groovy/src/main/groovy/org/springframework/integration/groovy/dsl/GroovyIntegrationFlowDefinition.groovy index 086d726e0e..9959283fc4 100644 --- a/spring-integration-groovy/src/main/groovy/org/springframework/integration/groovy/dsl/GroovyIntegrationFlowDefinition.groovy +++ b/spring-integration-groovy/src/main/groovy/org/springframework/integration/groovy/dsl/GroovyIntegrationFlowDefinition.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 the original author or authors. + * Copyright 2022-2025 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. @@ -269,14 +269,16 @@ class GroovyIntegrationFlowDefinition { * at the current {@link IntegrationFlow} chain position. * @param endpointConfigurer the {@link Consumer} to accept integration endpoint options. * @since 6.4 + * @deprecated in favor of {@link #controlBus} */ + @Deprecated(since = '6.5', forRemoval = true) + @SuppressWarnings('removal') GroovyIntegrationFlowDefinition controlBusOnRegistry( @DelegatesTo(value = GenericEndpointSpec, strategy = Closure.DELEGATE_FIRST) @ClosureParams(value = SimpleType.class, options = 'org.springframework.integration.dsl.GenericEndpointSpec') Closure endpointConfigurer = null) { - this.delegate.controlBusOnRegistry createConfigurerIfAny(endpointConfigurer) - this + controlBus endpointConfigurer } /** @@ -284,10 +286,7 @@ class GroovyIntegrationFlowDefinition { * at the current {@link IntegrationFlow} chain position. * @param endpointConfigurer the {@link Consumer} to accept integration endpoint options. * @see GenericEndpointSpec - * @deprecated in favor of {@link #controlBusOnRegistry} */ - @Deprecated(since = '6.4', forRemoval = true) - @SuppressWarnings('removal') GroovyIntegrationFlowDefinition controlBus( @DelegatesTo(value = GenericEndpointSpec, strategy = Closure.DELEGATE_FIRST) @ClosureParams(value = SimpleType.class, options = 'org.springframework.integration.dsl.GenericEndpointSpec') diff --git a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/ClientModeControlBusTests-context.xml b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/ClientModeControlBusTests-context.xml index 7a6b454fe7..c23f977cc0 100644 --- a/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/ClientModeControlBusTests-context.xml +++ b/spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/ClientModeControlBusTests-context.xml @@ -45,7 +45,7 @@ - + diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/dsl/JmsTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/dsl/JmsTests.java index 7ae1bb5f15..d57bf28c04 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/dsl/JmsTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/dsl/JmsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2024 the original author or authors. + * Copyright 2016-2025 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. @@ -358,7 +358,7 @@ public class JmsTests extends ActiveMQMultiContextTests { @Bean public IntegrationFlow controlBus() { - return IntegrationFlowDefinition::controlBusOnRegistry; + return IntegrationFlowDefinition::controlBus; } @Bean diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/UpdateMappingsTests-context.xml b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/UpdateMappingsTests-context.xml index 20322c00b6..a405809a41 100644 --- a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/UpdateMappingsTests-context.xml +++ b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/UpdateMappingsTests-context.xml @@ -21,7 +21,7 @@ - + diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/ControlBusParserTests-context.xml b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/ControlBusParserTests-context.xml index af2687a462..caa3e50579 100644 --- a/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/ControlBusParserTests-context.xml +++ b/spring-integration-jmx/src/test/java/org/springframework/integration/jmx/config/ControlBusParserTests-context.xml @@ -16,7 +16,7 @@ - + diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/self-destruction-context.xml b/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/self-destruction-context.xml index bb15bb1a47..536dd3f2e8 100644 --- a/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/self-destruction-context.xml +++ b/spring-integration-jmx/src/test/java/org/springframework/integration/monitor/self-destruction-context.xml @@ -14,7 +14,7 @@ - + diff --git a/spring-integration-jmx/src/test/java/org/springframework/integration_/mbeanexporterhelper/INT-2626-config.xml b/spring-integration-jmx/src/test/java/org/springframework/integration_/mbeanexporterhelper/INT-2626-config.xml index f76d8f210c..175a82b0a2 100644 --- a/spring-integration-jmx/src/test/java/org/springframework/integration_/mbeanexporterhelper/INT-2626-config.xml +++ b/spring-integration-jmx/src/test/java/org/springframework/integration_/mbeanexporterhelper/INT-2626-config.xml @@ -17,6 +17,6 @@ selector-expression="payload.contains('stop')" /> - + diff --git a/src/reference/antora/modules/ROOT/pages/whats-new.adoc b/src/reference/antora/modules/ROOT/pages/whats-new.adoc index 3a225ad7ac..a10d4d8b3c 100644 --- a/src/reference/antora/modules/ROOT/pages/whats-new.adoc +++ b/src/reference/antora/modules/ROOT/pages/whats-new.adoc @@ -18,3 +18,6 @@ In general the project has been moved to the latest dependency versions. The deprecated previously usage of `org.springframework.util.concurrent.ListenableFuture` has been removed in favor of `CompletableFuture`. +The previously deprecated SpEL-based Control Bus components have been removed in favor of functionality around `ControlBusCommandRegistry`. +The `` attribute is deprecated now without replacement since only `ControlBusCommandRegistry` functionality is available. +The Java DSL `controlBusOnRegistry()` operator is deprecated in favor of restored `controlBus()` which is fully based now on the `ControlBusCommandRegistry`.