Day 01 · Week 1 · Foundations

The story of Java backend.

Every annotation you'll meet, every layer you'll write, every odd pattern Spring Boot hides — all of it is the answer to a problem from somewhere in this 50-year story. By the end of today, you'll see through the magic.

~25 min read0 code to writeMental skeleton for everything ahead
Take your time. Read it twice if you need to. The mental skeleton you build today will pay back every single day for the next 8 weeks.
The journey at a glance

Why we start with history

Most courses throw you into Spring Boot on day one. You learn an annotation, you copy a snippet, it works. Magic. Until something breaks. Then you have no idea why.

The reason most learners feel lost in Spring Boot is they meet the solution before they ever met the problem. Without the problem, the solution feels arbitrary.

So today we walk through the problems first — in order. Each problem produces a solution. Each solution creates new problems. That is the entire history of Java backend in one sentence.

1970sPrograms lived on one machine

Picture a developer in 1975. There is no internet. No browsers. No "websites." A program ran on a single mainframe — a refrigerator-sized computer. Users connected through dumb terminals (just keyboards and screens with no brain of their own).

TerminalMainframe• your program• your database• your filesall in one place
One machine. One language (C). One database. Tightly coupled.

The dominant language was C. Every database came with its own C library. There was no concept of "the network." Everything was on one machine.

📌 Why this matters

Modern backend complexity exists almost entirely because we left this world. Microservices, REST APIs, JDBC, Spring — none of these would exist if programs still lived on one machine.

1980sC++ and the rise of OOP

C++ arrived. It added classes, inheritance, polymorphism — what we call Object-Oriented Programming. OOP was a way to organize bigger codebases without losing your mind.

C++ became the language of operating systems, compilers, and games — anything needing both performance and structure. But programs still lived on one machine. C++ was not used for "web development" because the web didn't exist yet for normal people.

📌 Take-away

OOP was invented to manage complexity within one program — not to build distributed systems. The patterns you'll meet later (Service, DAO, DTO) are OOP refinements applied to the web era.

1991–93The internet becomes public

Three things happened almost together: Tim Berners-Lee invents the World Wide Web at CERN (1989–91), the Mosaic browser launches (1993), and Internet Explorer + Netscape turn the web into a household thing by the mid-90s.

Suddenly, machines need to talk to each other over a network. This is a totally new problem that no language at the time was designed to solve cleanly.

How early websites worked

A browser asks for a page. A web server returns an HTML file (just text on disk). That's it. Static. Every visitor saw the same page. But people quickly wanted dynamic pages: "show me today's news", "log me in". How?

CGI scripts — the first "backend"

The first solution was called CGI (Common Gateway Interface). When a browser request came in, the web server would:

  1. Spawn a fresh process (start a new program from scratch)
  2. Run a script (usually Perl, sometimes C)
  3. Capture whatever the script printed
  4. Send that output back to the browser
BrowserrequestWeb serverspawn NEW processPerl process #1Perl process #2Perl process #3one processper request 💥
CGI: a brand-new operating-system process for every single HTTP request.

This worked. It was the first time the web had dynamic pages. But it was painfully slow. Spawning an OS process per request is expensive. If 1000 users hit the site at once, the server collapsed.

🧠 Reasoning point — remember this forever

The single performance problem of "one new process per request" is the reason every later technology — Servlets, Spring, Spring Boot — emphasizes long-lived, in-memory components. Hold onto this. It's the seed of everything that follows.

1995Java is born

Sun Microsystems releases Java with a marketing slogan: "Write Once, Run Anywhere." Compile your code once → it runs on Windows, Mac, Linux — without changes.

How? Java doesn't compile to machine code (the way C/C++ does). It compiles to bytecode — an intermediate language. Any computer with the JVM (Java Virtual Machine) installed can run that bytecode. The JVM translates it into the right instructions for whatever OS it's on.

HelloWorld.javayour source codejavacHelloWorld.classbytecode (portable)JVMWindowsmacOSLinuxruns anywhere
Compile once to bytecode. Any JVM can run it.

Java came in three flavors:

EditionWhat it covered
J2SE — StandardThe core language: OOP, collections, threads
J2ME — MicroPhones, embedded devices
J2EE — EnterpriseServer-side web apps: Servlets, JSP, JDBC
📌 Reality check on 'Core Java' vs 'Advanced Java'

These terms are not real categories. They're informal labels invented by trainers and the Indian job market. "Core Java" loosely means J2SE; "Advanced Java" loosely means J2EE. Real engineers don't use these terms — but you'll see them in job ads, so just know what they mean.

But here is a critical fact most learners miss: Java alone could not handle HTTP. Java had no built-in way to receive an HTTP request, parse it, and return an HTTP response. The language was great, but it was deaf and dumb to the web. Something had to bridge Java and HTTP.

Applets — Java's failed first try

Sun's first idea was to put Java inside the browser. Tiny Java programs called Applets ran via a JVM plugin. It failed: slow, security concerns, browsers killed plugins. Philosophically — business logic should run on a server you control. Sun pivoted: Java would run on the server. This pivot gave us Servlets.

~1997Servlets — Java's first real backend

A Servlet is a Java class that handles an HTTP request. But a Servlet alone does nothing — it needs a runtime called a Servlet Container. The most famous one is Apache Tomcat.

BrowserTomcatCoyoteHTTP listener · port 8080CatalinaServlet containerYour ServletdoGet() / doPost()HTTPdispatchSame Servlet,many threadsthread poolOne process. One Servlet object. Many threads serving many users.
Tomcat = Coyote (HTTP) + Catalina (Servlet container). One process, thread pool, long-lived Servlets.

CGI vs Servlets — the key shift

❌ CGI

  • 1 request = 1 new OS process
  • Heavy: process startup is slow
  • No memory between requests
  • Collapses under load
  • Languages: Perl, C

✅ Servlets

  • 1 Servlet object handles many requests
  • Threads, not processes
  • Stays loaded in memory
  • Scales to thousands of users
  • Language: Java
🧠 Reasoning point

Holding a Servlet in memory and using threads is the same insight powering every modern web framework you'll touch. Spring Boot's controllers? Same model — long-lived objects, thread-pool serving requests. The pattern hasn't changed in 25 years.

What the Servlet container does NOT do

You asked the perfect question: where does JSON → object conversion happen? In Spring Boot, @RequestBody magically converts JSON to a DTO. In Servlets — that magic doesn't exist. You write it yourself.

✅ The container DOES handle

  • Listening on the port
  • Parsing HTTP method, URL, headers
  • Wrapping the request in HttpServletRequest
  • Routing to the right Servlet by URL
  • Managing threads
  • Form-encoded body → req.getParameter()

❌ The container does NOT handle

  • JSON body → your DTO class
  • Validation of fields
  • Object → JSON for the response
  • Mapping URL path variables to method args
  • Layered architecture wiring
  • Database connection management
// Read the raw body bytes
String body = req.getReader().lines().collect(Collectors.joining());

// Manually call Jackson
ObjectMapper mapper = new ObjectMapper();
UserDto user = mapper.readValue(body, UserDto.class);

// Manually validate
if (user.getEmail() == null) { /* return 400 */ }
// ... then call your service ...
🔑 The big realization

Spring Boot's @RequestBody is doing exactly this code, hidden behind an annotation. The "magic" of Spring is just well-organized boilerplate that someone else wrote once. You'll see this pattern over and over.

The Servlet pain — and the layers we still use today

Imagine a registration form with 10 fields. In a raw Servlet, you'd extract each parameter, validate each, open a database connection, write SQL, close it, print HTML — all in one method. Horrible.

Developers in the early 2000s split this into layers:

Controller (the Servlet itself)handles HTTP, extracts parametersDTO (Data Transfer Object)a plain class holding the form fieldsService (business logic)validation, rules, orchestrationDAO (Data Access Object)all database queries live hereDatabase
The four layers — invented in the Servlet era, not in Spring.
🔑 The most important fact in this chapter

Controller, Service, DAO, DTO were invented in the Servlet era, not in Spring. Spring did not invent layered architecture. It just made wiring the layers more convenient. Most learners think these layers are "Spring stuff." They are not. They are Java enterprise patterns that predate Spring by ~5 years.

JSP — escaping "HTML inside Java"

Writing HTML inside Java with out.println() was awful. Sun invented JSP (Java Server Pages): HTML files with embedded Java snippets. The Servlet container compiled JSP files into Servlets behind the scenes. JSP is mostly dead today — replaced by REST APIs returning JSON, with React/Vue/Angular handling HTML on the client. We won't write any JSP. You only need to know it existed.

2003Spring is born

By the early 2000s, Java enterprise apps had become a mess: heavy EJBs (Enterprise Java Beans) needing expensive application servers, hundreds of XML files, and tightly-coupled code (every class created its own dependencies with new, making testing nearly impossible).

A developer named Rod Johnson wrote a book in 2002 showing a lighter way. The ideas became the Spring Framework.

Spring's two killer ideas

Before Spring · tight coupling

class A {
  B b = new B();
  // A controls how B is built
  // can't swap B for a fake
  // in tests
}

With Spring · IoC + DI

class A {
  B b;
  A(B b) { this.b = b; }
  // B is given to A
  // can swap easily
  // can test in isolation
}
📌 Don't worry about IoC/DI yet

You said this part felt confusing — that's totally fine. Week 3 (Days 15–21) is fully dedicated to IoC, DI, beans, and AOP. For Day 1, all you need is the one-line idea:

"Someone other than me is creating my objects and handing them to me."

That's it. The deep mental model comes later, when you have more context to attach it to.

2014Spring Boot

Spring Boot solved Spring's setup pain with two ideas:

Idea 1 · Convention over configuration

Sensible defaults everywhere. You only override what's truly different about your app.

Idea 2 · Embedded server

In the old world, you wrote a .war file then deployed it into a separately-installed Tomcat. Spring Boot ships Tomcat inside your JAR:

$ java -jar myapp.jar

…and your web app is running. No external Tomcat. No web.xml. This is the world we live in today.

todayThe modern Java backend stack

LayerModern choiceWhat it solves
FrameworkSpring BootWires everything, embedded server
PersistenceSpring Data JPA (on Hibernate)Talk to DB without SQL boilerplate
API styleREST + JSONClean, stateless, language-agnostic
FrontendReact / Vue / AngularBrowser handles HTML; Java only returns data
DeploymentDockerConsistent runtime, easy to ship
ArchitectureMicroservices + eventsIndependent teams, independent deploys

The full story in one frame

1970s — One machine. C. Database lib. ↓ 1980s — C++. OOP. Still one machine. ↓ 1990s — Web is born. CGI scripts. Slow process-per-request. ↓ 1995 — Java arrives. Applets fail. Servlets win on the server. ↓ 2000s — Servlet apps split into Controller / Service / DAO / DTO. JSP for templating. EJBs become bloated. Pain rises. ↓ 2003 — Spring. IoC + DI. Decouples your code. Tests become possible. ↓ 2014 — Spring Boot. Sensible defaults. Embedded Tomcat. java -jar. ↓ today — Spring Boot + JPA + REST + Docker + microservices.

What this means going forward

When you see…You'll know…
@RestControllerTomcat receives an HTTP request, maps the URL to your method. Same Servlet model under the hood.
@AutowiredSpring is doing IoC — handing you a dependency you didn't construct yourself.
@TransactionalSpring wraps your method with a database transaction. Uses AOP — covered in Week 3.
@Service / @RepositoryAnnotations on the same layered architecture from the Servlet era.
@RequestBodySpring's HttpMessageConverter doing what you'd write by hand — JSON → DTO via Jackson.
java -jar app.jarEmbedded Tomcat. The server lives inside your JAR.
Pause & reflect

Lock in today's learning

Take 10 minutes. Answer in your own words. If you can't, re-read the relevant section. Don't skip this.

  1. Why did CGI fail at scale? (Hint: process spawning)
  2. Why did Servlets succeed where CGI failed? (Hint: persistence + threading)
  3. Java alone cannot do HTTP. What bridges Java to HTTP?
  4. Were Controller, Service, DAO, DTO invented by Spring? If not, when?
  5. What problem does IoC solve that Servlet code had?
  6. What two problems did Spring Boot solve that plain Spring still had?

End of Day 1. Close the document. Let it sit overnight. The mental skeleton you just built will pay back every day for the next 8 weeks.