How to Create Spring Boot Application Using Maven

Creating a Spring Boot project using Maven is relatively straightforward. Let's set up a Spring Boot project with Maven from scratch. You can do it either through the Spring Initializr web tool or manually. 

Using Spring Initializr Web Tool 

Go to Spring Initializr

Choose the project settings: 

  • Project: Maven Project
  • Language: Java (default) 
  • Spring Boot version: Latest stable (default) 

Project Metadata: Fill in Group, Artifact, etc. 

Dependencies: Choose your desired dependencies (e.g., Spring Web, Spring Data JPA, Thymeleaf, etc.) 

Click on "Generate" to download the zip file. Extract the zip file and open it in your favorite IDE.

Manually Creating Project 

1. Create Project Structure: Create a new directory and inside it, create the following directories and files:

├── src/
│   └── main/
│       └── java/
│           └── com/
│               └── example/
│                   └──
├── pom.xml

2. Edit pom.xml: Open pom.xml and add the following content:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns=""


        <version>3.1.3</version> <!-- use the latest version -->



Make sure you specify the latest Spring Boot version. 

3. Edit Open src/main/java/com/example/ and add the following content:

package com.example;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

public class MyApp {
    public static void main(String[] args) {, args);

4. Build and Run: Navigate to your project directory and run the following commands:

mvn clean install
mvn spring-boot:run

Your Spring Boot application should now be running at http://localhost:8080/. Remember, Spring Boot allows you to add various other dependencies like JPA, Thymeleaf, Security, etc., based on your project needs. You can do this by adding them to your pom.xml.