Why Spring Boot: From XML Nightmares to Modern Cloud APIs
Discover how Spring Boot eliminated boilerplate XML, embedded web servers, and revolutionized enterprise Java from Spring Boot 2 to 3.
01The problem Spring Boot solves
Imagine you want to start a coffee shop.
In traditional enterprise Java (pre-Spring Boot), before you could brew a single cup of espresso, you had to:
- Mine the iron ore and forge your own espresso machine.
- Lay water pipes from the municipal reservoir to your shop.
- Write a 500-page manual (
web.xml,applicationContext.xml) detailing every pipe fitting. - Download a massive standalone web server (like Apache Tomcat), configure ports, build a
.warfile, and deploy it manually.
If a single XML tag had a typo, your server crashed on startup with a 2,000-line stack trace.
Spring Boot completely changes the game. It gives you a fully functional, pre-calibrated coffee machine. You plug it into the wall, press one button, and start serving coffee in under 30 seconds.
02The three pillars of Spring Boot
Spring Boot isn't a rewrite of the Spring framework. It is an opinionated, intelligent layer built on top of Spring. It rests on three pillars:
1. Starter dependencies (curated bundles)
Instead of hunting for 15 compatible library versions on Maven Central, you add one single starter:
- Want a REST API with JSON support? Add
spring-boot-starter-web. - Want PostgreSQL database access? Add
spring-boot-starter-data-jpa. - Want security and JWT? Add
spring-boot-starter-security.
Spring Boot tests all internal library versions together, completely eliminating "JAR dependency hell".
2. Auto-configuration (sensible defaults)
If Spring Boot spots spring-boot-starter-web on your classpath, it thinks:
"Aha. This developer is building a web application. I will automatically configure a DispatcherServlet, configure Jackson for JSON serialization, and start an embedded web server."
You don't configure anything unless you want to customize it.
3. Embedded web servers
Traditional Java apps had to be packaged as .war archives and dropped into external Tomcat installations. Spring Boot embeds Tomcat (or Jetty, or Undertow) directly inside your executable .jar file.
You run your backend with one command:
java -jar my-service.jar03Spring Boot 2 vs Spring Boot 3: What changed?
If you are interviewing today, knowing the difference between Spring Boot 2 and Spring Boot 3 is mandatory.
| Feature | Spring Boot 2.x (Legacy) | Spring Boot 3.x (Modern Standard) |
|---|---|---|
| Java Baseline | Java 8 or Java 11 | Java 17 minimum (Java 21 recommended) |
| Package Namespace | javax.servlet.*, javax.persistence.* | jakarta.servlet.*, jakarta.persistence.* |
| Concurrency | Heavy platform OS threads | Virtual Threads (spring.threads.virtual.enabled=true) |
| HTTP Client | RestTemplate (sync), WebClient (reactive) | Fluent synchronous RestClient |
| Native Compilation | Experimental | Out-of-the-box GraalVM Native Image support |
| Configuration Files | META-INF/spring.factories | META-INF/spring/org.springframework.boot...AutoConfiguration.imports |
04Your first Spring Boot API
Here is how simple a production-ready REST API looks in modern Spring Boot 3 with Java 21:
package com.veltoryx.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
@RestController
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
// Java 21 Record used as an immutable response DTO
public record Greeting(String message, String timestamp) {}
@GetMapping("/api/greet")
public Greeting greet(@RequestParam(defaultValue = "Engineer") String name) {
return new Greeting(
"Welcome to Veltoryx, " + name + "!",
java.time.Instant.now().toString()
);
}
}When you hit GET http://localhost:8080/api/greet?name=Vivek, Spring Boot automatically converts the Java record into clean JSON:
{
"message": "Welcome to Veltoryx, Vivek!",
"timestamp": "2026-10-31T00:20:00Z"
}05Common mistakes beginners make
- Forgetting that
@SpringBootApplicationscans sub-packages only: Spring Boot scans components in the package where your main class lives and all its child packages. If your controller is in a sibling package outside this tree, Spring Boot will never find it, and your endpoints return 404. - Manually adding Tomcat dependencies: Never add external Tomcat JARs. Spring Boot starters bring the embedded server automatically.
- Ignoring Java version requirements: Spring Boot 3 will refuse to run on Java 8 or Java 11. Your development environment must run JDK 17 or newer.
06In the interview
Common follow-up questions:
- What does an embedded server mean? It means the web server runtime (Tomcat) is packaged as a library inside the executable
.jarfile. Instead of deploying an app into a pre-installed server, the app carries its own server with it. - Why did Spring Boot 3 migrate from
javaxtojakarta? Oracle retained the trademark for "Java", so when enterprise APIs moved to the Eclipse Foundation as Jakarta EE 10, all package namespaces changed fromjavax.*tojakarta.*. Spring Boot 3 adopted this new standard. - What is the advantage of using Java 21 with Spring Boot 3.2+? Spring Boot 3.2 natively supports Virtual Threads via
spring.threads.virtual.enabled=true, allowing Tomcat to handle tens of thousands of concurrent I/O-bound requests on lightweight user-mode threads without thread pool starvation.
07Check your understanding
Quiz · 4 questions
0 of 4 answered
1. What was the primary motivation behind the creation of Spring Boot?
2. In Spring Boot 3, which package namespace must be used for Servlet and Persistence APIs?
3. Where does an embedded Tomcat server live in a Spring Boot application?
4. What is the minimum Java version required to run Spring Boot 3.x?