Once installed, the Spring Boot CLI can be run using the spring
command:
To get command-line help:
$ spring help
To create and run your first Spring Boot Project:
$ spring init my-app
$ cd my-app
$ spring run my-app
Open your browser to localhost:8080
:
$ open http://localhost:8080
You'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.java
mvnw
and mvnw.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 .yml
extension.)DemoApplicationTests.java
- A unit test that validates initialization of the Spring Boot application context.See the download page to manually download and unpack the latest version, or follow the links below:
$ brew tap pivotal/tap
$ brew install springboot
$ sudo port install spring-boot-cli
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