Setting Up with Spring Initializr
Spring Initializr is a website that builds a ready-to-run Spring Boot project for you — then you run it with one command.
What you will learn
- Create a project with Spring Initializr
- Pick the right starter dependencies
- Run the app and see it start
The easiest start: Spring Initializr
Spring Initializr (at start.spring.io) is a free website that generates a fresh Spring Boot project. You choose a few options, click Generate, and download a ready-to-run zip. No manual setup.
For your first projects, choose these options:
| Option | Pick | Why |
|---|---|---|
| Project | Maven | A common build tool (handles libraries for you) |
| Language | Java | The language you already know |
| Dependencies | Spring Web | Lets you build REST APIs (Unit 2) |
| Java version | The default | Whatever it suggests is fine |
A dependency (also called a starter) is a bundle of code Spring adds for you. Spring Web pulls in everything needed for web APIs. Later you will add Spring Data JPA for databases.
Run the app
Unzip the project, open it in an editor like IntelliJ IDEA or VS Code, and run it. From a terminal you can also use the included Maven wrapper.
# from inside the unzipped project folder
./mvnw spring-boot:run
# on Windows use: mvnw spring-boot:runNote: Output: . ___ ( ( )\___ | Spring Boot ... Tomcat started on port(s): 8080 (http) Started DemoApplication in 1.8 seconds Spring Boot started its own web server (Tomcat) on port 8080. Your app is now live at http://localhost:8080 — you did not install a server yourself.
Tip: See Tomcat started on port 8080? That means it worked. By default your app runs at http://localhost:8080. Right now there are no pages yet — you will add your first endpoint in Unit 2.
Watch out: If you see Port 8080 was already in use, another program is using that port. Stop the other app, or change the port by adding server.port=8081 to src/main/resources/application.properties.
Q. What does Spring Initializr do?
✍️ Practice
- Go to start.spring.io and create a Maven + Java project with the Spring Web dependency.
- Run the project and confirm you see “Tomcat started on port 8080”.
🏠 Homework
- Change the server port to 9090 using application.properties, run again, and note the new URL.