Skip to content

About

🌱 Documenting my daily hands-on Spring Boot learning journey, REST APIs & projects.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

14 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Spring Boot Learning Journey

Welcome to my Spring Boot repository! This repository documents my daily learning journey and hands-on practice with Coder Army.


πŸ“Œ About This Repository

  • Author: Alok Rana
  • Goal: Master Spring Boot framework and build scalable backend applications.
  • Tech Stack: Java 25, Spring Boot 4.x, Apache Maven, IntelliJ IDEA

πŸ—ΊοΈ Daily Topics Covered

βœ… Day 01: Introduction to Spring & Spring Boot

  • History of Spring Framework & problems with EJB
  • Core Java vs Spring Boot (Console vs Web Server)
  • Why Spring Boot: Inbuilt Embedded Tomcat, Starter Dependencies, Auto-Configuration

βœ… Day 02: First Spring Boot Application

  • Anatomy of @SpringBootApplication and Component Scanning
  • Creating first REST API with @RestController and @GetMapping
  • Configuring application port (server.port=9090)
  • Running and testing endpoints (/hello, /age)

βœ… Day 03: Apache Maven Deep Dive

  • What is a Build Tool & why Maven is used
  • Understanding pom.xml: GAV Coordinates (groupId, artifactId, version)
  • Starters & Transitive Dependencies
  • Dependency Scopes (compile vs test)
  • Maven Wrapper (mvnw) for standalone builds

βœ… Day 04: Understanding DI & IoC via Loose Coupling

  • Tight Coupling vs Loose Coupling (Why IoC is needed)
  • Hands-on implementation: NotificationService interface with EmailService, SmsService, and PopupService
  • Constructor Dependency Injection in OrderService

βœ… Day 05: Spring IoC Container & Bean Management

  • Managing beans via Spring's AnnotationConfigApplicationContext
  • Configuration & Component Scanning (@Configuration, @ComponentScan)
  • @Component (Automatic discovery) vs @Bean (Explicit object creation)
  • Creating Parameterized Beans via @Bean method (User model initialized with custom state)
  • Constructor Injection using @Autowired
  • Custom Qualifier naming (@Qualifier("Sms"), @Qualifier("pop"), @Qualifier("Email"))

βœ… Day 06: Circular Dependency & Resolution

  • Understanding Circular Dependency loops (OrderService ⇄ PaymentService)
  • Diagnosing BeanCurrentlyInCreationException during Constructor Injection
  • Breaking the circular reference cycle:
    • Approach 1: Field Injection (@Autowired) via two-phase bean lifecycle
    • Approach 2: Constructor Injection with @Lazy proxy injection

βœ… Day 07: Spring Bean Scopes & Lazy Loading

  • Understanding Spring Bean Scopes: @Scope("singleton") vs @Scope("prototype")
  • Eager vs Lazy Loading:
    • Default Singleton behavior (Eagerly instantiated at container startup)
    • Applying @Lazy on Singleton beans to defer instantiation until first use
    • Prototype beans instantiated on demand (Lazy by design)
  • Practical demo: Shared PrinterService (Singleton with @Lazy) vs Isolated ShoppingCart (Prototype)
  • Understanding why Spring uses @Lazy(false) instead of a dedicated @Eager annotation

βœ… Day 08: Spring Bean Lifecycle & Spring vs Spring Boot

  • Deep dive into Bean Lifecycle phases: Instantiation βž” Property Injection βž” Initialization βž” Active βž” Destruction
  • Modern Annotation-based Lifecycle Callbacks: @PostConstruct and @PreDestroy
  • Constructor vs @PostConstruct: Why initialization logic belongs in @PostConstruct (dependencies are null at constructor time)
  • Graceful shutdown and resource cleanup via context.close()
  • Core architectural differences: Traditional Spring vs Spring Boot (Auto-configuration, Embedded Tomcat, Starters)

πŸ“‚ Project Structure

.
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main/
β”‚   β”‚   β”œβ”€β”€ java/com/example/demo/
β”‚   β”‚   β”‚   β”œβ”€β”€ _di_ioc/               # Spring IoC Container & Dependency Injection
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ BeanLifeCycle/     # Day 8: Bean Lifecycle (@PostConstruct & @PreDestroy)
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ ConfiApp.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ DatabaseConnection.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ DatabaseService.java
β”‚   β”‚   β”‚   β”‚   β”‚   └── Main.java
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ circulardependency/# Circular Dependency & Resolution via Field Injection
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ AppConfig.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ OrderService.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ PaymentService.java
β”‚   β”‚   β”‚   β”‚   β”‚   └── Main.java
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ beanscopes/        # Bean Scopes (Singleton vs Prototype)
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ AppConfig.java
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ PrinterService.java # @Scope("singleton")
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ ShoppingCart.java   # @Scope("prototype")
β”‚   β”‚   β”‚   β”‚   β”‚   └── Main.java
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ user/
β”‚   β”‚   β”‚   β”‚   β”‚   └── User.java      # POJO model created via @Bean
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ AppConfig.java     # @Configuration, @ComponentScan, @Bean
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ EmailService.java  # @Component, @Primary, @Qualifier("Email")
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ SmsService.java    # @Component, @Qualifier("Sms")
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ PopupService.java  # @Component, @Qualifier("pop")
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ NotificationService.java # Interface
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ OrderService.java  # @Component, @Autowired
β”‚   β”‚   β”‚   β”‚   └── Main.java          # IoC Container runner
β”‚   β”‚   β”‚   β”œβ”€β”€ DemoApplication.java   # Spring Boot entry point
β”‚   β”‚   β”‚   └── HelloController.java   # Day 2 REST controller
β”‚   β”‚   └── resources/
β”‚   β”‚       └── application.properties # Configuration (server.port=9090)
β”‚   └── test/                          # Unit tests
β”œβ”€β”€ pom.xml                            # Maven dependencies & plugins
└── README.md

⭐ Updated daily with each topic covered!

About

🌱 Documenting my daily hands-on Spring Boot learning journey, REST APIs & projects.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages