The Spring Boot CLI allows you to easily create and work with Spring Boot applications from the command-line.
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.