Below is architecture of Spring Framework:

AspectSpring FrameworkSpring Boot
PurposeA comprehensive framework for building enterprise-grade applications.Simplifies development by providing auto-configuration and embedded servers.
ConfigurationRequires extensive manual setup using XML or Java-based configurations.Provides auto-configuration, reducing boilerplate code and simplifying setup.
FocusModular components for custom solutions.Productivity and ease of development with opinionated defaults.
DeploymentRequires external web/application servers like Tomcat or Jetty.Includes embedded servers (e.g., Tomcat, Jetty) for standalone applications.
Development EffortHigher effort needed for configuring and integrating components.Simplifies development with pre-configured starter projects and sensible defaults.
Key Features- Dependency Injection- Aspect-Oriented Programming- Transaction Management- Web MVC Framework- Auto-Configuration- Embedded Servers- Spring Starters (pre-defined dependencies)- Production-Ready Features (e.g., Actuator)
Learning CurveSteeper learning curve due to the need to understand the core components.Easier for beginners by hiding much of the complexity of the Spring Framework.
PerformanceFully customizable for high-performance scenarios.Quick to set up and sufficient for most use cases, though less flexibility than the core framework.
When to UseWhen you need highly customized applications with full control over configurations.When you want to rapidly develop and deploy applications with minimal setup.

Key Spring Projects

  • Spring Data: Tools for working with SQL and NoSQL databases.
  • Spring Cloud: Provides tools for building and managing distributed systems.
  • Spring Security: Handles authentication and authorization for applications.
  • Spring Session: Manages distributed web application sessions.
  • Spring Integration: Implements enterprise integration patterns.
  • Spring Batch: Designed for batch processing tasks.
  • Spring State Machine: An open-source framework for building state machines.

Simple App in Spring Boot

Runtime and Architecture

  1. Runtime Environment:
    • The application runs on the host OS within a JVM.
    • The embedded Tomcat server initializes Spring Boot, routing requests to the application.
  2. Request Flow:
    • Requests are routed to Spring MVC controllers.
    • Controllers delegate to a service layer.
    • Services interact with Spring Data JPA repositories.
    • Repositories interface with Hibernate to generate SQL for database operations.
    • Thymeleaf engine generates HTML responses for the browser.

Development Process

  • Components:
    • Controllers: Handle HTTP requests and responses.
    • Services: Encapsulate business logic; written with interfaces for flexibility.
    • Repositories: Use Spring Data JPA for database interactions; no SQL required.
    • Domain Objects: Plain Old Java Objects (POJOs) configured as JPA entities for persistence.
  • Design Patterns:
    • Organized into packages: controllers, services, repositories, and domain.
    • Services and repositories leverage interfaces for dependency injection and modularity.

Key Features

  • Database: Hibernate facilitates database communication without requiring custom SQL.
  • Output: Data retrieval and persistence handled seamlessly, with responses rendered via Thymeleaf.