Why Spring Boot?
Spring Boot has become one of the most popular Java frameworks for building enterprise-grade applications. It simplifies Java development by removing boilerplate configuration, allowing developers to focus on writing business logic.
Whether you’re a beginner or transitioning into Java from another language, Spring Boot is your fast-track to creating secure, scalable web applications β and this guide will show you how.
Prerequisites
Before we dive in, make sure you have the following:
- Java 17 or 21 installed
- Maven or Gradle (Java build tools)
- An IDE like IntelliJ IDEA, Eclipse, or VS Code
- Internet connection to download Spring dependencies
Step 1: Initialize the Project
Go to https://start.spring.io
Choose the following options:
- Project: Maven or Gradle
- Language: Java
- Spring Boot Version: 3.x
- Group:
com.mahquests
- Artifact:
first-java-app
- Dependencies: Spring Web, Spring Boot DevTools, Spring Data JPA, H2 Database (for testing)
Then click βGenerateβ β this downloads a .zip
file containing your new project.
Step 2: Unzip and Open in IDE
- Extract the
.zip
file - Open the folder in your IDE (e.g., IntelliJ or Eclipse)
- Wait for the build tool (Maven/Gradle) to download dependencies
Step 3: Build Your First REST Controller
Inside src/main/java/com/mahquests/firstjavaapp
, create a new Java class:
package com.mahquests.firstjavaapp;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloController {
@GetMapping("/hello")
public String sayHello() {
return "Welcome to Your First Spring Boot App!";
}
}Step 4: Run the Application
Open FirstJavaAppApplication.java
(your main entry point):
javaCopyEdit@SpringBootApplication
public class FirstJavaAppApplication {
public static void main(String[] args) {
SpringApplication.run(FirstJavaAppApplication.class, args);
}
}
Run the application. Once it starts, visit:
π http://localhost:8080/hello
You should see:
β
“Welcome to Your First Spring Boot App!”Step 4: Run the Application
Open FirstJavaAppApplication.java
(your main entry point):
javaCopyEdit@SpringBootApplication
public class FirstJavaAppApplication {
public static void main(String[] args) {
SpringApplication.run(FirstJavaAppApplication.class, args);
}
}
Run the application. Once it starts, visit:
π http://localhost:8080/hello
You should see:
β
“Welcome to Your First Spring Boot App!”Step 4: Run the Application
Open FirstJavaAppApplication.java
(your main entry point):
javaCopyEdit@SpringBootApplication
public class FirstJavaAppApplication {
public static void main(String[] args) {
SpringApplication.run(FirstJavaAppApplication.class, args);
}
}
Run the application. Once it starts, visit:
π http://localhost:8080/hello
You should see:
β
“Welcome to Your First Spring Boot App!”Step 4: Run the Application
Open FirstJavaAppApplication.java
(your main entry point):
javaCopyEdit@SpringBootApplication
public class FirstJavaAppApplication {
public static void main(String[] args) {
SpringApplication.run(FirstJavaAppApplication.class, args);
}
}
Run the application. Once it starts, visit:
π http://localhost:8080/hello
You should see:
β
“Welcome to Your First Spring Boot App!”Step 4: Run the Application
Open FirstJavaAppApplication.java
(your main entry point):
javaCopyEdit@SpringBootApplication
public class FirstJavaAppApplication {
public static void main(String[] args) {
SpringApplication.run(FirstJavaAppApplication.class, args);
}
}
Run the application. Once it starts, visit:
π http://localhost:8080/hello
You should see:
β
“Welcome to Your First Spring Boot App!”Step 4: Run the Application
Open FirstJavaAppApplication.java
(your main entry point):
javaCopyEdit@SpringBootApplication
public class FirstJavaAppApplication {
public static void main(String[] args) {
SpringApplication.run(FirstJavaAppApplication.class, args);
}
}
Run the application. Once it starts, visit:
π http://localhost:8080/hello
You should see:
β
“Welcome to Your First Spring Boot App!”Step 4: Run the Application
Open FirstJavaAppApplication.java
(your main entry point):
javaCopyEdit@SpringBootApplication
public class FirstJavaAppApplication {
public static void main(String[] args) {
SpringApplication.run(FirstJavaAppApplication.class, args);
}
}
Run the application. Once it starts, visit:
π http://localhost:8080/hello
You should see:
β
“Welcome to Your First Spring Boot App!”Step 4: Run the Application
Open FirstJavaAppApplication.java
(your main entry point):
javaCopyEdit@SpringBootApplication
public class FirstJavaAppApplication {
public static void main(String[] args) {
SpringApplication.run(FirstJavaAppApplication.class, args);
}
}
Run the application. Once it starts, visit:
π http://localhost:8080/hello
You should see:
β
“Welcome to Your First Spring Boot App!”Step 4: Run the Application
Open FirstJavaAppApplication.java
(your main entry point):
javaCopyEdit@SpringBootApplication
public class FirstJavaAppApplication {
public static void main(String[] args) {
SpringApplication.run(FirstJavaAppApplication.class, args);
}
}
Run the application. Once it starts, visit:
π http://localhost:8080/hello
You should see:
β
“Welcome to Your First Spring Boot App!”Step 4: Run the Application
Open FirstJavaAppApplication.java
(your main entry point):
javaCopyEdit@SpringBootApplication
public class FirstJavaAppApplication {
public static void main(String[] args) {
SpringApplication.run(FirstJavaAppApplication.class, args);
}
}
Run the application. Once it starts, visit:
π http://localhost:8080/hello
You should see:
β
“Welcome to Your First Spring Boot App!”
Step 5: Add a Data Layer (Bonus Step)
Want to make your app more dynamic?
Create a Student Entity:
javaCopyEdit@Entity
public class Student {
@Id
@GeneratedValue
private Long id;
private String name;
}
Create a Repository:
javaCopyEditpublic interface StudentRepository extends JpaRepository<Student, Long> {
}
Spring Boot automatically provides CRUD operations β no implementation needed!
Real-World Relevance
What you just built is the foundation of most enterprise applications:
- Financial APIs for transactions
- Government data services
- HR & compliance systems
- Telecom user management platforms
Thatβs why companies still trust Java and Spring Boot to run their critical operations β and why Java skills are in demand in 2025.
Learn Java the Right Way β With Mah Quests Enterprises
We donβt just teach Java β we teach how to apply Java in real-world, regulated industries like banking, insurance, and telecom.
Our training includes:
β
Java 21 + Spring Boot
β
Hands-on labs and use cases
β
POPIA-compliant coding patterns
β
Secure app development
π© Ready to Build Your Skills?
Join our Java for Financial Services: Compliance and Security course β or contact us to upskill your dev team.
π§ hello@mahquests.co.za
π www.mahquests.co.za