How Browsers Load a Web Page

Image
How Browsers Load a Web Page Understanding how a browser loads a web page is essential for anyone who works with websites—developers, designers, and even content creators.  When you understand this workflow, you can optimize performance, fix rendering delays, and improve user experience and Core Web Vitals. 1. Step 1 — URL Input & DNS Lookup The browser loading journey begins the moment a user types a URL like: https: //example.com 1.1 What happens next? The browser checks its internal cache for a DNS record. If not found, it queries the operating system DNS cache. If still not found, the OS sends a request to a DNS resolver. The resolver returns the IP address (e.g., 93.184.216.34 ) of the server hosting the website. 1.2 Why it matters DNS lookup adds latency. Slow DNS affects Time to First Byte (TTFB). 2. Step 2 — Establishing a TCP & TLS Connection 2.1 TCP Handshake After DNS lookup, the browser must establish a connection using the TCP ...

Spring MVC vs Spring Boot

Spring MVC vs Spring Boot

Spring MVC vs Spring Boot


Spring is one of the most powerful and widely used frameworks in the Java ecosystem. 

Among its many projects, Spring MVC and Spring Boot are two technologies that Java web developers frequently encounter. 

While they are closely related, they serve different purposes and offer very different development experiences.



1. Understanding the Spring Framework Ecosystem

Before comparing Spring MVC and Spring Boot, it is important to understand where they fit within the Spring ecosystem.

  • Spring Framework: The core framework providing dependency injection (DI), inversion of control (IoC), and modular infrastructure.

  • Spring MVC: A web framework built on the Spring Framework for creating web applications using the Model-View-Controller pattern.

  • Spring Boot: A project designed to simplify Spring application setup, configuration, and deployment.

In simple terms:

  • Spring MVC focuses on web application architecture

  • Spring Boot focuses on productivity and simplification



2. What Is Spring MVC?

2.1 Overview

Spring MVC is a request-driven web framework based on the Model-View-Controller (MVC) design pattern. 

It provides structured separation between:

  • Model (business data)

  • View (UI)

  • Controller (request handling)

Spring MVC gives developers full control over configuration and application behavior.


2.2 Spring MVC Architecture

Key components include:

  • DispatcherServlet – Front controller that receives all requests

  • Controller – Handles user requests

  • View Resolver – Resolves logical view names to actual views (JSP, Thymeleaf)

  • Model – Holds application data



2.3 Spring MVC Example

2.3.1 Controller Example

@Controller @RequestMapping("/mvc") public class MvcController { @GetMapping("/hello") public String hello(Model model) { model.addAttribute("message", "Hello from Spring MVC"); return "hello"; } }


2.3.2 JSP View (hello.jsp)

<html> <body> <h2>${message}</h2> </body> </html>


2.3.3 How It Works

  1. Browser sends a request

  2. DispatcherServlet receives it

  3. Controller processes the request

  4. View is rendered and returned




3. What Is Spring Boot?

3.1 Overview

Spring Boot is an extension of the Spring Framework that removes much of the boilerplate configuration required by traditional Spring applications. 

It provides:

  • Auto-configuration

  • Embedded web servers

  • Opinionated defaults

Spring Boot allows developers to create production-ready applications quickly.


3.2 Key Features of Spring Boot

  • Embedded Tomcat, Jetty, or Undertow

  • No XML configuration required

  • Convention over configuration

  • Standalone executable JARs

  • Production-ready features (Actuator)



3.3 Spring Boot Example

3.3.1 Main Application Class

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

3.3.2 REST Controller

@RestController @RequestMapping("/boot") public class BootController { @GetMapping("/hello") public String hello() { return "Hello from Spring Boot"; } }

3.3.3 How It Works

  • Embedded server starts automatically

  • No external deployment required

  • Application runs with a single command



4. Key Differences Between Spring MVC and Spring Boot

Aspect Spring MVC Spring Boot
Purpose Web MVC framework Rapid application development
Configuration Manual, verbose Auto-configuration
Server External (Tomcat, etc.) Embedded server
Setup Time Longer Very fast
Deployment WAR file Executable JAR
Learning Curve Steeper Easier


5. Configuration Differences

5.1 Spring MVC Configuration

Traditionally requires:

  • XML or Java-based configuration

  • Web.xml

  • DispatcherServlet setup

  • ViewResolver configuration


5.2 Spring Boot Configuration

  • Minimal configuration

  • application.properties or YAML

  • Auto-detection of dependencies

  • Sensible defaults

This difference alone significantly impacts developer productivity.



6. Practical Comparison: Same Feature, Different Approach


6.1 Spring MVC Request Flow

  1. Configure DispatcherServlet

  2. Map controller manually

  3. Configure view resolver

  4. Deploy to external server


6.2 Spring Boot Request Flow

  1. Add dependency

  2. Write controller

  3. Run application

Spring Boot drastically simplifies the process.



7. Advantages of Spring MVC

7.1 Advantages

  • Fine-grained control

  • Suitable for complex enterprise systems

  • Clear MVC architecture

  • Mature and stable


7.2 Disadvantages

  • Heavy configuration

  • Slower project setup

  • More boilerplate code


8. Advantages of Spring Boot

8.1 Advantages

  • Extremely fast development

  • Reduced configuration

  • Easy microservices support

  • Built-in monitoring and metrics

  • Ideal for cloud-native apps


8.2 Disadvantages

  • Less control over internal configuration

  • Hidden complexity

  • Not ideal for learning low-level Spring internals



9. Spring MVC vs Spring Boot: When to Use Which?

9.1 Use Spring MVC when:

  • You need full control over configuration

  • Maintaining legacy Spring applications

  • Working in highly customized enterprise environments


9.2 Use Spring Boot when:

  • Starting new projects

  • Building REST APIs or microservices

  • Prioritizing speed and simplicity

  • Deploying to cloud environments



10. Spring MVC and Spring Boot Together

It is important to understand that Spring Boot does not replace Spring MVC.

In fact:

  • Spring Boot often uses Spring MVC internally

  • You can build Spring MVC applications using Spring Boot

  • Spring Boot simplifies Spring MVC configuration

This makes Spring Boot the preferred choice for most modern Spring MVC applications.


11. Learning Path Recommendation

For beginners:

  1. Learn Java fundamentals

  2. Understand Servlets and JSP

  3. Learn Spring MVC basics

  4. Move to Spring Boot

This progression builds strong conceptual understanding.


12. Conclusion

Spring MVC and Spring Boot serve different but complementary roles in Java web development. 

Spring MVC provides a robust and structured approach to building web applications, while Spring Boot focuses on developer productivity and rapid application development.

For most modern projects, Spring Boot is the recommended choice, as it simplifies configuration and deployment while still leveraging the power of Spring MVC under the hood. 

However, understanding Spring MVC remains essential for mastering the Spring ecosystem and maintaining enterprise-level applications.

By understanding both technologies, developers gain the ability to build scalable, maintainable, and production-ready Java web applications with confidence.

Popular posts from this blog

The Early Search Engines: Yahoo, AltaVista, and the Dawn of Web Discovery

The Birth of Internet Cafes and Online Communities

How Browsers Load a Web Page