Notes on Spring and Spring Boot
Spring Framework:
1. Overview:
- Spring is a powerful, lightweight, and comprehensive framework for Java.
- It provides support for enterprise-level applications, offering various modules such as IOC, AOP,
MVC, etc.
2. Features:
- Inversion of Control (IoC): Decouples the objects from each other by using dependency injection.
- Aspect-Oriented Programming (AOP): Separates cross-cutting concerns like logging, security,
etc., from business logic.
- Spring MVC: Simplifies building web applications with an MVC architecture.
- Spring JDBC: Eases interaction with databases.
- Integration: Supports integration with various technologies and frameworks.
3. Modules:
- Core Container: Includes Beans, Core, Context, and Expression Language modules.
- Data Access/Integration: JDBC, ORM, JMS, and Transactions.
- Web: Web, Web MVC, Websocket, WebFlux.
- AOP: Provides aspect-oriented programming capabilities.
4. Advantages:
- Modular architecture and flexibility.
- Open-source and community-driven.
- Simplifies enterprise-level development.
Spring Boot:
1. Overview:
- Spring Boot is built on top of the Spring Framework, designed to simplify the development of
production-ready applications.
- It eliminates the need for extensive XML configuration.
2. Features:
- Auto-Configuration: Automatically configures Spring applications based on the dependencies on
the classpath.
- Standalone Applications: Comes with an embedded web server (Tomcat, Jetty, etc.), allowing
applications to run independently.
- Spring Boot Starters: Simplify dependency management by bundling commonly-used
dependencies.
- Actuator: Provides operational endpoints to monitor and manage the application.
3. Components:
- Spring Boot CLI: Command-line tool for quickly building applications.
- Spring Boot Starters: Pre-defined templates for dependencies.
- Spring Boot Actuator: For monitoring and managing applications.
4. Advantages:
- Rapid application development.
- Reduced boilerplate code and configurations.
- Easy integration with Spring Ecosystem.
5. Key Concepts:
- Application.properties/YAML: Centralized configuration for the application.
- Spring Initializr: Tool for generating project structure with desired dependencies.
- Embedded Web Servers: Allows running applications without external servers.