Spring Modules & Ecosystem
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 MODULAR hai — sirf zaroori modules use karo
- Core modules: Core, MVC, Data, Security, Boot, Cloud
- Independent modules — footprint chhota rakhne ke liye
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.
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>