DEV Community

Cover image for How to Build Your First Java Web App (2025 Spring Boot Guide)
SRF DEVELOPER
SRF DEVELOPER

Posted on • Originally published at srfdeveloper.com

How to Build Your First Java Web App (2025 Spring Boot Guide)

This tutorial was originally published on SRF Developer. Check out the blog for the full step-by-step setup.


You have learned the basics of Java (Loops, Classes, Arrays). But your code still only lives in the black console window. ⬛

How do you put Java on the Internet?

In 2025, we don't use raw Servlets or JSP anymore. We use Spring Boot. It is the industry standard that powers companies like Netflix and Uber.

Today, let's build your first "Hello World" website in 3 steps.

🛠️ Step 1: The Setup (Spring Initializr)

You don't need to write configuration files from scratch.

  1. Go to start.spring.io
  2. Select Maven and Java.
  3. Add the "Spring Web" dependency.
  4. Click Generate & Open in IntelliJ/VS Code.

💻 Step 2: The Code

You only need ONE file to make a web server. Create a simple Controller.

package com.example.demo;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

    @GetMapping("/")
    public String home() {
        return "<h1>Hello, World! I built this with Java. 🚀</h1>";
    }
}
Enter fullscreen mode Exit fullscreen mode

🚀 Step 3: Run It!

​Click the "Run" button in your IDE.
Open your browser and go to http://localhost:8080.

​Boom. You are now a Java Web Developer.

​##🎯 What's Next? (HTML & Databases)

​Sending raw text is boring. You need to learn how to serve real HTML pages and connect to a Database (MySQL).

​👉 Read the Full Guide: Adding HTML & CSS to Java

Top comments (0)