May 2, 2018

Textual description of firstImageUrl

Spring Boot Microservice using CLI : How to start development of SpringBoot microservice using Spring Command line tool

In few clicks we can start development of microservice using Spring Boot. Follow below steps to setup SpringBoot CLI and start creating microservice.

1. Download file from below repo or below URL.

2. Unzip the downloaded zip file. Open a terminal window and change the terminal prompt to the bin folder.
Optional: Add bin folder to the system path so that Spring Boot can be run from any location.

3. Verify the CLI installation with the following command. On success, the Spring CLI version will be printed in the console:

4. Now we are ready to create our first microservice (REST service using Groovy). Create a file with name app.groovy and paste below code lines in it. I have created a directory "springBootCLI" and created a fie app.groovy in it and added below code in it.

class HelloworldController {
    String sayHello() {
        "Hello, Devinline!"

5. Run Groovy application using following command. I am executing this command from bin directory and executing app.groovy.

  bin ./spring run /Users/n0r0082/springBootCLI/app.groovy 

6. Once application has been successfully started, we can view service output in browser at "http://localhost:8080/".

Spring Boot automatically picked up Tomcat as the webserver and embedded it into the application, deploy it and its accessible on localhost at port 8080.

Location: Bengaluru, Karnataka, India