Client (Browser)

Sign Up Form

Payload Preview (JSON):
{
  "name": "Jeremy",
  "role": "Professor"
}
Server (Spring Boot)
JSON
Entrance
1. Controller Layer (@RestController)
@PostMapping("/users")
public User create(@RequestBody User u) {
    // JSON is converted to 'u' here!
    return service.save(u);
}
Logic
2. Service Layer (@Service)
public User save(User u) {
    u.setCreatedAt(new Date());
    // Business Logic...
    return repo.save(u);
}
Data Access
3. Repository Layer (@Repository)
public interface UserRepo 
       extends JpaRepository {
    // Generates SQL automatically
}
Database (MySQL)
ID
Name
Role
Empty table...
System INFO Application started on port 8080...