From 99e6503a0739795cc1fc6612e41293fcfd0f78cd Mon Sep 17 00:00:00 2001 From: Christian Dupuis Date: Thu, 20 Mar 2014 14:52:14 +0100 Subject: [PATCH] Some polish to the endpoint command --- .../src/main/resources/commands/crash/endpoint.groovy | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/spring-boot-starters/spring-boot-starter-shell/src/main/resources/commands/crash/endpoint.groovy b/spring-boot-starters/spring-boot-starter-shell/src/main/resources/commands/crash/endpoint.groovy index b817343a996..f82cd2539ab 100644 --- a/spring-boot-starters/spring-boot-starter-shell/src/main/resources/commands/crash/endpoint.groovy +++ b/spring-boot-starters/spring-boot-starter-shell/src/main/resources/commands/crash/endpoint.groovy @@ -20,7 +20,12 @@ class endpoint { @Usage("Invoke provided actuator endpoint") @Command - def invoke(InvocationContext context, @Usage("The object name pattern") @Required @Argument String name) { + def invoke(InvocationContext context, @Usage("The name of the Endpoint to invoke") @Required @Argument String name) { + + // Don't require passed argument to end with 'Endpoint' + if (!name.endsWith("Endpoint")) { + name = name + "Endpoint" + } context.attributes['spring.beanfactory'].getBeansOfType(Endpoint.class).each { n, endpoint -> if (n.equals(name) && endpoint.isEnabled()) { @@ -30,7 +35,7 @@ class endpoint { out.println mbean.getData() } else { - out.println mbean.invoke() + out.println mbean.endpoint.invoke() } }