Spring Boot CLI

1 | Written on Thu 20 December 2018. Posted in Tutorials | Richard Walker

This tutorial will demonstrate how to configure the Spring Boot CLI.

Spring Boot is an opinionated instance of a Spring application. Spring Boot is a rapid application development platform. It uses various components of Spring, but has additional niceties like the ability to package your application as a runnable jar, which includes an embedded tomcat (or jetty) server.

It common to start a Spring Boot project using the web page https://start.spring.io/, which is fine but here we'll demonstrate setting up a Linux client with the Spring Boot CLI.

Manually installing Spring Boot CLI

Binaries added in my guides are always done at the user profile level, ensure the is a bin directory in your home directory:

mkdir ~/bin

Next download and extract the spring-boot-cli



tar -xvf ~/Downloads/spring-boot-cli-2.1.3.RELEASE-bin.tar.gz -C ~/bin

Next add and export the SPRING_HOME to you PATH:

vi ~/.bash_profile

    export SPRING_HOME=~/bin/spring-2.1.3.RELEASE
    export PATH=$SPRING_HOME/bin:$PATH

This will take effect when logging back in however it can be reloaded:

source ~/.bash_profile

Test the spring command is now working:

spring --version

Using init with the spring command lets you create a new project like using start.spring.io without leaving the shell.

To see all the options which can be included use:

spring init --list

Finally create a starter project:

spring init --build=maven --java-version=1.8 --dependencies=web,thymeleaf,actuator,devtools sample.zip