Installing the Spring Boot CLI
Introduction#
The Spring Boot CLI allows you to easily create and work with Spring Boot applications from the command-line.
Remarks#
Once installed, the Spring Boot CLI can be run using the spring command:
To get command-line help:
$ spring helpTo create and run your first Spring Boot Project:
$ spring init my-app
$ cd my-app
$ spring run my-appOpen your browser to localhost:8080:
$ open https://localhost:8080You’ll get the whitelabel error page because you haven’t yet added any resources to your application, but you’re all ready to go with just the following files:
my-app/
├── mvnw
├── mvnw.cmd
├── pom.xml
└── src/
├── main/
│ ├── java/
│ │ └── com/
│ │ └── example/
│ │ └── DemoApplication.java
│ └── resources/
│ └── application.properties
└── test/
└── java/
└── com/
└── example/
└── DemoApplicationTests.javamvnwandmvnw.cmd- Maven wrapper scripts that will download and install Maven (if necessary) on the first use.pom.xml- The Maven project definitionDemoApplication.java- the main class that launches your Spring Boot application.application.properties- A file for externalized configuration properties. (Can also be given a.ymlextension.)DemoApplicationTests.java- A unit test that validates initialization of the Spring Boot application context.
Manual Installation
See the download page to manually download and unpack the latest version, or follow the links below:
Install on Mac OSX with HomeBrew
$ brew tap pivotal/tap
$ brew install springbootInstall on Mac OSX with MacPorts
$ sudo port install spring-boot-cliInstall on any OS with SDKMAN!
SDKMAN! is the Software Development Kit Manager for Java. It can be used to install and manage versions of the Spring Boot CLI as well as Java, Maven, Gradle, and more.
$ sdk install springboot