1.1 Spring Boot Project Setup
Spring Initializr (start.spring.io): selecting dependencies, project structure (src/main/java, resources, test). Maven vs Gradle (Maven for this module). pom.xml: dependency management, parent POM, starter dependencies. Running a Spring Boot app: @SpringBootApplication, embedded Tomcat. The "Hello World" that actually serves HTTP.
1.2 Dependency Injection & IoC
Inversion of Control: Spring creates and manages objects (beans). @Component, @Service, @Repository, @Controller — stereotype annotations. @Autowired: constructor injection (preferred), field injection, setter injection. @Bean and @Configuration for manual bean creation. Bean scopes: singleton (default), prototype, request, session. Why DI matters: testability, loose coupling, modularity.
1.3 REST API: @RestController & Endpoints
@RestController = @Controller + @ResponseBody. @GetMapping, @PostMapping, @PutMapping, @PatchMapping, @DeleteMapping. Path variables: @PathVariable. Query parameters: @RequestParam. Request body: @RequestBody. Response: ResponseEntity (status code + body + headers). Building a complete CRUD API for a resource. REST conventions: nouns in URLs, HTTP verbs as actions.
1.4 Application Configuration & Profiles
application.yml (preferred over .properties). Configuration properties: server port, database URL, custom settings. @Value for injecting properties. @ConfigurationProperties for typed config. Profiles: application-dev.yml, application-prod.yml. Activating profiles: spring.profiles.active. Environment-specific database URLs, feature flags, logging levels. The 12-Factor App principle: config in environment.
1.5 Request Validation & Error Handling
Bean Validation: @NotNull, @NotBlank, @Size, @Email, @Min, @Max on DTOs. @Valid on @RequestBody to trigger validation. Custom validators with @Constraint. Global exception handling: @ControllerAdvice + @ExceptionHandler. Custom error response format (timestamp, message, path). Handling 404, 400, 500 gracefully. Never expose stack traces to clients.
1.6 Layered Architecture & DTOs
Controller → Service → Repository (the standard Spring architecture). Why layers: separation of concerns, testability, maintainability. DTO (Data Transfer Object): separate API shape from database entity. MapStruct or manual mapping for Entity ↔ DTO conversion. @Service for business logic. @Repository for data access. Never expose JPA entities directly in REST responses.
1.7 API Documentation: OpenAPI/Swagger
springdoc-openapi: auto-generates API docs from your controllers. Swagger UI: interactive API testing in the browser. @Operation, @ApiResponse, @Schema annotations for enriching docs. Exporting OpenAPI spec (JSON/YAML). Why API documentation matters: frontend developers consume your API using these docs. Swagger UI replaces Postman for basic API testing during development.
Placement relevance: Spring Boot is the #1 Java backend framework — used by TCS, Infosys, Wipro, Cognizant, and every enterprise Java shop. "Build a REST API" is the most common full-stack interview assignment. Understanding DI, layered architecture, and validation is what separates "watched a tutorial" from "can build production code."