How mady20/learning-spring works
This repository is a set of independent Spring learning experiments, not one application. Its examples cover dependency injection and bean configuration, HTTP request-data handling, JWT authentication, Gemini API integration, and WebSocket chat. The principal user-facing flows are the echo endpoints and the authentication endpoints; the authentication service coordinates user lookup, password checks, token creation, and logout blacklisting. The map includes documented modules whose source was not sampled, but omits uncertain internal wiring for them.
Main entry points: AuthService.java Auth Workflow · AuthController.java Auth Endpoints · JwtTokenProvider.java JWT Provider · EchoController.java Echo Endpoints
Components 21
Dependency Injection
- Coupling Examples
prerequisites - Component Scanning
component-scanning-way/src/main/java/com/example/demo - XML Bean Config
xml-config-way/src/main - Java Bean Config
annotation-config-way/src/main/java/com/example/manual
HTTP APIs
- Echo Endpoints
api-basics/src/main/java/com/mady/echo/EchoController.java - Message DTO
api-basics/src/main/java/com/mady/echo/Message.java
Authentication
- Auth Endpoints
auth-service/src/main/java/com/mady/auth_service/controller/AuthController.java - Auth Workflow
auth-service/src/main/java/com/mady/auth_service/service/AuthService.java - JWT Provider
auth-service/src/main/java/com/mady/auth_service/service/JwtTokenProvider.java - JWT Filter
auth-service/src/main/java/com/mady/auth_service/security/JwtAuthenticationFilter.java - Security Config
auth-service/src/main/java/com/mady/auth_service/config/SecurityConfig.java - User Repository
auth-service/src/main/java/com/mady/auth_service/repository/UserRepository.java - User Database
- Redis Blacklist
External Integrations
- Gemini Endpoints
gemini-integration/src/main/java/com/example/gemini_integration/controller/GeminiController.java - Gemini Service
gemini-integration/src/main/java/com/example/gemini_integration/service/GeminiService.java - Gemini API
Realtime Chat
- Chat Client
websocket/client/index.html - WebSocket Config
websocket/src/main/java/com/example/websocket/WebSocketConfig.java - Chat Handler
websocket/src/main/java/com/example/websocket/ChatHandler.java
Other components
- API User
Connections 14
- API User → Echo Endpoints: sends requests
- Echo Endpoints → Message DTO: reads body
- API User → Auth Endpoints: sends requests
- Auth Endpoints → Auth Workflow: calls
- Auth Endpoints → JWT Provider: validates refresh
- Auth Workflow → User Repository: reads and saves
- Auth Workflow → JWT Provider: creates tokens
- JWT Filter → JWT Provider: validates tokens
- Auth Workflow → Redis Blacklist: blacklists token
- User Repository → User Database: persists users
- Gemini Endpoints → Gemini Service: delegates
- Gemini Service → Gemini API: calls
- Chat Client → WebSocket Config: opens connection
- WebSocket Config → Chat Handler: registers handler