Featured Article

Simple Spring Boot Application Tutorial: Build Your First App in Minutes

Kenneth Jul 13, 2026

Spring Boot, the popular Java-based framework, simplifies building stand-alone, production-ready applications. This tutorial will guide you through creating a simple Spring Boot application, step-by-step, from project creation to running your first endpoint.

Spring Boot MongoDB Java Tutorial With Examples - JavaTechOnline
Spring Boot MongoDB Java Tutorial With Examples - JavaTechOnline

By the end of this guide, you'll have a solid introduction to Spring Boot's core features, including dependency management, automatic configuration, and embedded servers.

Spring Boot, MySQL, JPA, Hibernate Restful CRUD API Tutorial
Spring Boot, MySQL, JPA, Hibernate Restful CRUD API Tutorial

Setting Up Your Development Environment

Before you start, ensure you have Java (1.8 or later) and Apache Maven (3.6 or later) installed on your system. You can verify the installations by running the following commands:

Building a Hello World Web Application with Spring MVC and JSP | Spring Boot Guide
Building a Hello World Web Application with Spring MVC and JSP | Spring Boot Guide

$ java -version <br />$ mvn -version

Creating a New Spring Boot Project

How To Work With MongoDB In Spring Boot Project?
How To Work With MongoDB In Spring Boot Project?

Open your terminal/command prompt and navigate to the directory where you'd like to create your project. Then, run:

$ spring init --dependencies=web --lang=java --name=my-first-spring-app --version=1.0.0

The spring init command generates a new Spring Boot project with the 'web' dependency, sets the name and version, and JDK compliance. After completion, navigate into your new project:

Spring Boot: Mastering Task Scheduling with Cron Expressions | Spring Boot Guide
Spring Boot: Mastering Task Scheduling with Cron Expressions | Spring Boot Guide

Exploring Project Structure

Use the following commands to navigate into your project and list the files:

cd my-first-spring-app <br />ls

Spring Boot Tutorial for Beginners 7 - Spring Data JPA
Spring Boot Tutorial for Beginners 7 - Spring Data JPA

You'll see a *.iml and pom.xml file, a src/main/java folder containing the Application.java file, and the target directory. Note that the .iml file is for IntelliJ IDEA and doesn't affect your project functionality.

Running Your First Spring Boot Application

Optimizing Frontend Integration: How a Spring Boot Application Works with React, Angular & Vue
Optimizing Frontend Integration: How a Spring Boot Application Works with React, Angular & Vue
What Is Spring Boot in Java? Beginner Guide 2026
What Is Spring Boot in Java? Beginner Guide 2026
the book spring framework cookbook
the book spring framework cookbook
Event-Driven Microservices using Spring Boot and Kafka
Event-Driven Microservices using Spring Boot and Kafka
Autowired in Spring Boot Explained in Simple Words
Autowired in Spring Boot Explained in Simple Words
Easy Spring Kids Craft: Flower Boots Art
Easy Spring Kids Craft: Flower Boots Art
Spring Boot Web Application, Part 5 – Spring Security - Spring Framework Guru
Spring Boot Web Application, Part 5 – Spring Security - Spring Framework Guru
Spring Security With Spring Boot
Spring Security With Spring Boot
Oauth Security
Oauth Security

apunhRun your application using Maven with the following command:

mvn spring-boot:run

Open your browser and navigate to http://localhost:8080 to see your application running. The default Spring Boot page lists the application's healthy status and provides an informative 'Whitelabel Error Page' if you trigger an error.

Creating Your First REST Endpoint

Open Application.java and modify the main method to create and configure an instance of Spring Boot's WebApplicationType:

@SpringBootApplication
public class MyFirstSpringAppApplication {

  public static void main(String[] args) {
    SpringApplication.run(MyFirstSpringAppApplication.class, args);
  }
}

Create a new class called HelloWorldController in the same package and add the following.java file:

Mapping Your First Route

Tell Spring Boot to map a route to your controller by using the @GetMapping annotation. Open HelloWorldController.java and add the following code to map the route to your default page:

@RestController
public class HelloWorldController {

  @GetMapping("/")
  public String helloWorld() {
    return "Hello, World!";
  }
}

Restart your application using mvn spring-boot:run and open your browser to http://localhost:8080. You should now see the text "Hello, World!" displayed instead of the default Spring Boot page.

Your first Spring Boot application is now complete! This exercise serves as a solid foundation for building more complex applications using Spring Boot's extensive feature set. Start exploring other components of Spring Boot, such as Spring Data for database access and Spring Security for authentication and authorization.