🧱
Basics

Spring Modules & Ecosystem

Core, MVC, Data, Security waghera
💡 Spring ecosystem ek TOOLBOX hai jisme alag-alag specialized tools hain — screwdriver (Spring Core), hammer (Spring MVC), drill (Spring Data) — zaroorat ke hisaab se sirf JIS tool ki zaroorat hai wahi uthaओ, poora toolbox carry karne ki zaroorat nahi.

Spring MONOLITHIC nahi hai — MODULAR hai. Spring Core (IoC container, DI) foundation hai. Spring Context (ApplicationContext) advanced container features deता hai. Spring MVC web applications ke liye. Spring Data database access simplify karta hai (JPA, MongoDB, Redis waghera). Spring Security authentication/authorization ke liye. Spring Boot rapid application setup ke liye (auto-configuration).

Har module INDEPENDENT hai — tum sirf Spring Core use kar sakte ho (bina web ke), ya sirf Spring Data (bina MVC ke). Maven/Gradle dependencies mein sirf JIS module ki zaroorat hai wahi add karo — isse application ka footprint chhota rehta hai, aur unnecessary complexity avoid hoti hai.

<!-- Maven — sirf zaroori modules add karo: -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>      <!-- MVC + embedded Tomcat -->
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jpa</artifactId>  <!-- Data access -->
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-security</artifactId>  <!-- Auth -->
</dependency>
🧱
Spring ecosystem ek TOOLBOX hai jisme alag-alag specialized tools hain — screwdriver (Spring Core), hammer (Spring MVC), drill (Spring Data) — zaroorat ke hisaab se sirf JIS tool ki zaroorat hai wahi uthaओ, poora toolbox carry karne ki zaroorat nahi.
1 / 2
⚡ Quick Recap
  • Spring MODULAR hai — sirf zaroori modules use karo
  • Core modules: Core, MVC, Data, Security, Boot, Cloud
  • Independent modules — footprint chhota rakhne ke liye
On this page (2 subtopics)

Spring Core module BeanFactory provide karta hai — SABSE BASIC IoC container. Spring Context module ISKE UPAR ApplicationContext deता hai — extra features jaise event publishing, internationalization (i18n), aur automatic BeanPostProcessor detection. Practically, Context hi hamesha use hota hai.

💡Tip: Do modules alag hone ka reason HISTORICAL/architectural separation hai — Core "engine" hai, Context us engine ke UPAR "richer features" ka layer hai.

Spring Boot starters SPECIFIC use-cases ke liye bundled dependencies hain — spring-boot-starter-web (REST APIs), spring-boot-starter-data-jpa (database), spring-boot-starter-test (testing tools, JUnit + Mockito + AssertJ sab ek saath).

<!-- Testing ke liye SAB kuch ek starter mein: -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
    <scope>test</scope>
</dependency>