O'Reilly logo

Learning Spring Boot by Greg L. Turnquist

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating custom CRaSH commands

In Chapter 1, Quick Start with Groovy, we got an initial glimpse of CRaSH (http://www.crashub.org/), the shell for Java apps. We took a quick tour of that application. In this section, we'll not only add CRaSH, but also write some custom commands.

First, we need to add spring-boot-starter-remote-shell to the build file:

compile("org.springframework.boot:spring-boot-starter-remote-shell")

Now when we run our app, we will have a lot of out-of-the-box management features. However, the focus of this section is to create some custom commands and then see them in action.

Spring Boot Actuator will look in classpath*:/commands/ and classpath*:/crash/commands/ for any Groovy scripts. Let's write one!

Create src/main/resources/commands/activemq.groovy ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required