0–5 min
Real Hook
5–20 min
Core Concept
20–40 min
Live Coding
40–55 min
You Code It
55–60 min
Cheat Sheet
🔥 Real-World Hook (0–5 min)

Before Spring Boot: setting up a Java web server took 3 days of XML config, WAR file deployment, and endless boilerplate.

After Spring Boot: 30 seconds. One annotation and your app is running. Swiggy, Razorpay, Urban Company — all use Spring Boot backends. Today you build your first REST API.

🪝 What Spring Boot Does For You (5–20 min)

💡 Analogy

Raw Java is building a car from scratch — engine, seats, wheels, fuel system. Spring Boot is buying a car — it comes configured. You just turn the key (@SpringBootApplication) and drive.

💻 Live Coding — Student REST API (20–40 min)

// pom.xml dependency
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-web</artifactId>
</dependency>
// Model
public class Student {
    private Long id;
    private String name;
    private String email;
    private String dept;
    // constructors + getters + setters
}

// Controller — maps HTTP requests to methods
@RestController
@RequestMapping("/api/students")
public class StudentController {

    private List<Student> students = new ArrayList<>();
    private Long nextId = 1L;

    @GetMapping
    public List<Student> getAll() {
        return students;
    }

    @GetMapping("/")
    public ResponseEntity<Student> getById(@PathVariable Long id) {
        return students.stream()
            .filter(s -> s.getId().equals(id))
            .findFirst()
            .map(ResponseEntity::ok)
            .orElse(ResponseEntity.notFound().build());
    }

    @PostMapping
    public ResponseEntity<Student> create(@RequestBody Student s) {
        s.setId(nextId++);
        students.add(s);
        return ResponseEntity.status(201).body(s);
    }

    @DeleteMapping("/")
    public ResponseEntity<Void> delete(@PathVariable Long id) {
        students.removeIf(s -> s.getId().equals(id));
        return ResponseEntity.noContent().build();
    }
}
🎯 You Code It (40–55 min)
  1. Create a Spring Boot project at start.spring.io — add "Spring Web" dependency
  2. Create a Product class: id, name, price (double), category
  3. Create ProductController with: GET all, GET by id, POST create, DELETE
  4. Add GET /api/products/category/{cat} — return products filtered by category
  5. Test using Postman or curl http://localhost:8080/api/products
  6. Show: All 5 endpoints working in Postman

📄 Day 7 Cheat Sheet — Spring Boot

Core Annotations

@SpringBootApplicationMain class
@RestControllerHTTP endpoints
@ServiceBusiness logic
@RepositoryData access
@ComponentGeneric bean
@AutowiredInject dependency

HTTP Mappings

@GetMappingGET request
@PostMappingPOST request
@PutMappingPUT request
@DeleteMappingDELETE request
@RequestMapping("/base")Base path
@PathVariable Long idURL param

Request/Response

@RequestBody T objJSON body -> object
@RequestParam String x?x=val query param
ResponseEntity.ok(body)200 OK with body
ResponseEntity.status(201)Custom status
ResponseEntity.notFound()404
ResponseEntity.noContent()204 No Content

application.properties

server.port=8080Change port
spring.datasource.url=...DB URL
spring.datasource.username=...DB user
spring.jpa.show-sql=trueLog SQL
spring.jpa.hibernate.ddl-auto=updateAuto schema