Spring Boot Complete Basics - Notes
============================================================
1. What is Spring Framework?
------------------------------------------------------------
- A Java framework for building enterprise applications.
- Provides IoC (Inversion of Control) and DI (Dependency Injection).
============================================================
2. What is Spring Boot?
------------------------------------------------------------
- Built on top of Spring Framework.
- Makes Spring development fast and easy.
Features of Spring Boot:
* Auto-Configuration: Automatically configures beans based on dependencies.
* Embedded Server: Comes with Tomcat/Jetty; no WAR deployment needed.
* Starter Dependencies: Pre-packaged dependencies (e.g., spring-boot-starter-web).
* Production Ready: Metrics, health checks (via Actuator).
============================================================
3. Core Concepts:
------------------------------------------------------------
- IoC: Spring controls object creation instead of developer.
- DI: Spring injects dependencies automatically.
- Bean: An object managed by Spring IoC container.
- Configuration: Defines beans using @Configuration and @Bean.
- Annotations:
* @Component, @Service, @Repository -> Mark classes as beans.
* @Autowired -> Injects beans automatically.
Diagram (IoC & DI Flow):
Spring Container
|
|--- Creates Beans (@Component, @Service)
|--- Injects dependencies (@Autowired)
============================================================
4. Setting Up Project (Spring Initializr):
------------------------------------------------------------
Steps:
- Go to [Link]
- Choose: Maven, Java, Spring Boot version.
- Add dependencies: Spring Web.