From e332ce988a83db6ea80d775c8c9c6d3c4108cc28 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Wed, 14 Aug 2024 11:59:42 -0400 Subject: [PATCH] Fix `ControlBusControllerConfiguration` for `FormattingConversionService` * Use `ObjectProvider` instead for injection to resolve the target bean later when we check that `spring-mvc` or `spring-webflux` is present in classpath * Fix `control-bus-controller.adoc` for `{beanName}` attribute resolution attempt --- .../http/config/ControlBusControllerConfiguration.java | 9 ++++----- .../modules/ROOT/pages/http/control-bus-controller.adoc | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/config/ControlBusControllerConfiguration.java b/spring-integration-http/src/main/java/org/springframework/integration/http/config/ControlBusControllerConfiguration.java index c6fa6fdc27..8d766ddd1d 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/config/ControlBusControllerConfiguration.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/config/ControlBusControllerConfiguration.java @@ -19,7 +19,7 @@ package org.springframework.integration.http.config; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.ObjectProvider; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -46,18 +46,17 @@ public class ControlBusControllerConfiguration { @Bean ControlBusController controlBusController(ControlBusCommandRegistry controlBusCommandRegistry, - @Qualifier("mvcConversionService") FormattingConversionService conversionService) { + ObjectProvider conversionService) { if (!HttpContextUtils.WEB_MVC_PRESENT && !HttpContextUtils.WEB_FLUX_PRESENT) { LOGGER.warn("The 'IntegrationGraphController' isn't registered with the application context because" + - " there is no 'org.springframework.web.servlet.DispatcherServlet' or" + - " 'org.springframework.web.reactive.DispatcherHandler' in the classpath."); + " there is no 'spring-mvc' or 'spring-webflux' in the classpath."); return null; } controlBusCommandRegistry.setEagerInitialization(true); - return new ControlBusController(controlBusCommandRegistry, conversionService); + return new ControlBusController(controlBusCommandRegistry, conversionService.getIfUnique()); } } diff --git a/src/reference/antora/modules/ROOT/pages/http/control-bus-controller.adoc b/src/reference/antora/modules/ROOT/pages/http/control-bus-controller.adoc index 810d101f74..6abb801799 100644 --- a/src/reference/antora/modules/ROOT/pages/http/control-bus-controller.adoc +++ b/src/reference/antora/modules/ROOT/pages/http/control-bus-controller.adoc @@ -69,7 +69,7 @@ The `/control-bus` GET request returns all the control bus commands for the appl Essentially, a JSON-serialized list of `ControlBusController.ControlBusBean` instances. Each entry is a bean with a list of control bus eligible methods (see `ControlBusMethodFilter` for more information) with their parameter types and description from the `@ManagedOperation` or `@ManagedAttribute` (falls back to method name otherwise). -The GET method of this REST controller for `/control-bus/{beanName}` returns commands for specific bean. +The GET method of this REST controller for `/control-bus/\{beanName}` returns commands for specific bean. The POST method to `/control-bus/{beanName.methodName}` invokes the command. The body of the request may contain a list of values and their types for command to execute.