diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/management/ControlBusController.java b/spring-integration-http/src/main/java/org/springframework/integration/http/management/ControlBusController.java index 00eeb50554..585d2041b0 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/management/ControlBusController.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/management/ControlBusController.java @@ -82,33 +82,6 @@ public class ControlBusController implements BeanFactoryAware, InitializingBean .toList(); } - @GetMapping(name = "getCommandsForBean", path = "/{beanName}") - public ControlBusBean getCommandsForBean(@PathVariable String beanName) { - Map commandsForBean = - this.controlBusCommandRegistry.getCommands() - .get(beanName); - - return createControlBusBean(beanName, commandsForBean); - } - - private ControlBusBean createControlBusBean(String beanName, - Map commandsForBean) { - - List commands = - commandsForBean.keySet() - .stream() - .map(this::converControlBusCommand) - .toList(); - - return new ControlBusBean(beanName, commands); - } - - private ControlBusCommand converControlBusCommand(ControlBusCommandRegistry.CommandMethod commandMethod) { - return new ControlBusCommand(commandMethod.getBeanName() + '.' + commandMethod.getMethodName(), - commandMethod.getDescription(), - Arrays.asList(commandMethod.getParameterTypes())); - } - @PostMapping(name = "invokeCommand", path = "/{command}") public Object invokeCommand(@PathVariable String command, @RequestBody(required = false) List arguments) { @@ -133,6 +106,24 @@ public class ControlBusController implements BeanFactoryAware, InitializingBean return commandExpression.getValue(this.evaluationContext, parameterValues); } + private static ControlBusBean createControlBusBean(String beanName, + Map commandsForBean) { + + List commands = + commandsForBean.keySet() + .stream() + .map(ControlBusController::converControlBusCommand) + .toList(); + + return new ControlBusBean(beanName, commands); + } + + private static ControlBusCommand converControlBusCommand(ControlBusCommandRegistry.CommandMethod commandMethod) { + return new ControlBusCommand(commandMethod.getBeanName() + '.' + commandMethod.getMethodName(), + commandMethod.getDescription(), + Arrays.asList(commandMethod.getParameterTypes())); + } + public record ControlBusBean(String beanName, List commands) { } diff --git a/spring-integration-http/src/test/java/org/springframework/integration/http/management/ControlBusControllerTests.java b/spring-integration-http/src/test/java/org/springframework/integration/http/management/ControlBusControllerTests.java index fc8c85d4da..ceb827841f 100644 --- a/spring-integration-http/src/test/java/org/springframework/integration/http/management/ControlBusControllerTests.java +++ b/spring-integration-http/src/test/java/org/springframework/integration/http/management/ControlBusControllerTests.java @@ -83,18 +83,6 @@ public class ControlBusControllerTests { .andExpect(content().string(Matchers.containsString("The overloaded operation with two arguments"))); } - @Test - void commandsForBean() throws Exception { - this.mockMvc.perform(get("/control-bus/testManagementComponent") - .accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) - .andExpect(handler().handlerType(ControlBusController.class)) - .andExpect(handler().methodName("getCommandsForBean")) - .andExpect(content().string(Matchers.containsString("testManagementComponent.operation"))) - .andExpect(content().string(Matchers.containsString("testManagementComponent.operation2"))); - } - @Test void controlBusCommandIsPerformedOverRestCall() throws Exception { this.mockMvc.perform(post("/control-bus/testManagementComponent.operation") 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 6abb801799..b33baa79cf 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,8 +69,6 @@ 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 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. For example, the `operation` command with `int` argument for the class: