Spring MVC course
Learn Spring MVC step by step: 478 lessons in 35 modules with worked examples, quizzes and interview questions. Free on JavaSchoolLab.
Spring MVC Fundamentals
- Introduction to Spring MVC
- MVC Architecture
- Model
- View
- Controller
- Spring MVC Architecture Flow
- Spring MVC vs Spring Boot
- Spring MVC vs Spring Framework
- Advantages of Spring MVC
- Request-Response Lifecycle
- Front Controller Pattern
- DispatcherServlet
- Mini Project: Following One Request Through Spring MVC
DispatcherServlet
- What is DispatcherServlet?
- DispatcherServlet Architecture
- DispatcherServlet Initialization
- DispatcherServlet Request Flow
- HandlerMapping
- HandlerAdapter
- HandlerExceptionResolver
- ViewResolver
- View
- Model
- ModelAndView
- Request Processing Pipeline
- Mini Project: Inside the DispatcherServlet: Mappings and the Handler Chain
Spring MVC Configuration
- XML-Based Configuration
- Java-Based Configuration
- @Configuration
- @EnableWebMvc
- WebMvcConfigurer
- Component Scanning
- MVC Configuration
- Static Resource Configuration
- Message Converter Configuration
- Formatter Configuration
- Interceptor Configuration
- View Resolver Configuration
- Mini Project: Configuring Spring MVC with WebMvcConfigurer
Controllers
- @Controller
- @RestController
- Controller Lifecycle
- Controller Methods
- Request Mapping
- @RequestMapping
- @GetMapping
- @PostMapping
- @PutMapping
- @DeleteMapping
- @PatchMapping
- Mapping HTTP Methods
- Mapping URL Paths
- Class-Level Mapping
- Method-Level Mapping
- Multiple URL Mappings
- Consumes
- Produces
- Mini Project: Controller Types and Mapping Rules
Request Handling
- HTTP Request
- HTTP Response
- Request Parameters
- @RequestParam
- Path Variables
- @PathVariable
- Request Headers
- @RequestHeader
- Cookies
- @CookieValue
- Request Body
- @RequestBody
- HttpServletRequest
- HttpServletResponse
- HttpSession
- Principal
- Locale
- Request Attributes
- Mini Project: Reading Every Part of a Request
Model & View
- Model
- ModelMap
- ModelAndView
- Adding Data to Model
- Reading Model Data
- Returning View Name
- Returning ModelAndView
- View Rendering
- View Resolution
- ViewResolver
- InternalResourceViewResolver
- Redirect
- Forward
- redirect:
- forward:
- Mini Project: Model, ModelAndView and the Post-Redirect-Get Flash Message
View Technologies
- JSP
- JSTL
- Thymeleaf
- FreeMarker
- Mustache
- HTML Templates
- Static HTML
- Template Resolution
- Layouts
- Form Binding
- Server-Side Rendering
- Mini Project: One Model, Three Views: HTML, JSON and Redirect
Form Handling
- HTML Forms
- Spring MVC Forms
- Form Submission
- Form Data Binding
- @ModelAttribute
- Command Objects
- Form DTO
- BindingResult
- Form Validation
- GET Form
- POST Form
- Form Error Handling
- Redirect After POST
- PRG Pattern - Post/Redirect/Get
- Mini Project: Registration Form with Post-Redirect-Get
Data Binding
- Data Binding
- Property Binding
- Automatic Binding
- Custom Data Binding
- WebDataBinder
- @InitBinder
- Property Editors
- Converters
- Formatters
- Custom Formatter
- Custom Converter
- Type Conversion
- Mini Project: Data Binding: Converters, Formatters and Safe Fields
Validation
- Spring Validation
- Bean Validation
- Jakarta Validation
- @Valid
- @Validated
- BindingResult
- Validator
- Custom Validator
- Errors
- FieldError
- ObjectError
- Validation Messages
- Validation Groups
- Form Validation
- REST Request Validation
- Mini Project: Hotel Booking Validation: Groups, Custom Rules and Error Codes
Exception Handling
- Exception Handling in Spring MVC
- @ExceptionHandler
- @ControllerAdvice
- @RestControllerAdvice
- Global Exception Handling
- HandlerExceptionResolver
- Custom Error Pages
- HTTP Error Responses
- Custom Error Response
- Validation Exceptions
- Business Exceptions
- Mini Project: Exception Handling Layers
REST API with Spring MVC
- REST Architecture
- RESTful API Design
- REST Controller
- @RestController
- JSON Request
- JSON Response
- Jackson
- ObjectMapper
- JSON Serialization
- JSON Deserialization
- HttpMessageConverter
- MappingJackson2HttpMessageConverter
- ResponseEntity
- HTTP Status Codes
- API Versioning
- REST API Best Practices
- Mini Project: REST Details: PUT vs PATCH, Pagination, ETag and Allowed Methods
HTTP Message Converters
- What is HttpMessageConverter?
- JSON Converter
- XML Converter
- String Converter
- Byte Array Converter
- Form Converter
- Jackson Integration
- Custom Message Converter
- Content Negotiation
- Accept Header
- Content-Type Header
- Mini Project: A Custom CSV Message Converter
Interceptors
- Spring MVC Interceptors
- HandlerInterceptor
- preHandle()
- postHandle()
- afterCompletion()
- Interceptor Registration
- Multiple Interceptors
- Logging Interceptor
- Authentication Interceptor
- Authorization Interceptor
- Request Tracking
- Performance Monitoring
- Mini Project: Interceptor Chain Order and Short-circuiting
Filters
- Servlet Filter
- Filter vs Interceptor
- Filter
- OncePerRequestFilter
- Request Logging Filter
- Authentication Filter
- CORS Filter
- Character Encoding Filter
- Filter Chain
- Filter Ordering
- Mini Project: Servlet Filters Around Spring MVC
Servlet Integration
- Servlet Basics
- Servlet Lifecycle
- Servlet Container
- Tomcat
- HttpServletRequest
- HttpServletResponse
- HttpSession
- ServletContext
- ServletConfig
- Filter
- Listener
- DispatcherServlet and Servlet Container
- Mini Project: Using the Servlet API Inside Spring MVC
Session Management
- HTTP Session
- HttpSession
- Session Attributes
- Session Timeout
- Cookie-Based Session
- URL Rewriting
- Session Management
- Stateless vs Stateful Application
- Mini Project: Shopping Cart in the HTTP Session
Cookies
- HTTP Cookies
- Creating Cookies
- Reading Cookies
- Updating Cookies
- Deleting Cookies
- Secure Cookies
- HttpOnly
- SameSite
- Cookie-Based Authentication
- Mini Project: Preferences Stored in Cookies
File Upload & Download
- Multipart Request
- MultipartFile
- File Upload
- Multiple File Upload
- File Validation
- File Size Validation
- File Type Validation
- File Download
- Streaming Response
- Resource
- ResponseEntity<Resource>
- Large File Handling
- Mini Project: Multi-file Upload and Downloads (CSV, Binary, Cached Image)
Internationalization
- Internationalization - i18n
- Localization - l10n
- Locale
- LocaleResolver
- LocaleChangeInterceptor
- MessageSource
- ResourceBundleMessageSource
- Language Properties
- Multi-Language Applications
- Dynamic Language Switching
- Mini Project: A Multi-language Welcome Page
Theme Support
- Spring MVC Themes
- ThemeResolver
- ThemeSource
- Theme Configuration
- Dynamic Themes
- Mini Project: Light and Dark Theme Switcher (Cookie + Interceptor)
Content Negotiation
- Content Negotiation
- JSON vs XML
- Accept Header
- Content-Type
- URL-Based Content Negotiation
- Parameter-Based Content Negotiation
- Header-Based Content Negotiation
- Custom Content Negotiation
- Mini Project: Same Data as JSON or XML
CORS
- What is CORS?
- Same-Origin Policy
- Cross-Origin Requests
- @CrossOrigin
- Global CORS Configuration
- CORS Filter
- Preflight Request
- OPTIONS Request
- CORS Security
- Mini Project: Cross-Origin Rules for a Public API
Spring MVC Security Integration
- Spring Security Integration
- Authentication
- Authorization
- Login
- Logout
- Form Login
- Basic Authentication
- Session Authentication
- Security Filters
- CSRF
- CORS + Security
- Role-Based Authorization
- Method-Level Security
- Security Context
- Principal
- Mini Project: Form Login, CSRF and Method Security
Spring MVC + Database
- MVC + JDBC
- MVC + JPA
- MVC + Hibernate
- Repository Layer
- Service Layer
- Controller Layer
- DAO Pattern
- DTO Pattern
- Entity Mapping
- Transaction Management
- Database Exception Handling
- Mini Project: Customer CRUD over JDBC with Transactions
Layered Architecture
- Controller Layer
- Service Layer
- Repository Layer
- DAO Layer
- Entity Layer
- DTO Layer
- Mapper Layer
- Utility Layer
- Configuration Layer
- Exception Layer
- Separation of Concerns
- Mini Project: Layered Application: Each Layer Tested on Its Own
Spring MVC + AJAX
- AJAX
- Spring MVC AJAX Requests
- JSON AJAX
- Fetch API
- jQuery AJAX
- Asynchronous Form Submission
- Dynamic Page Updates
- REST API Integration
- Mini Project: One URL, Page for Browsers and JSON for AJAX
Spring MVC + Thymeleaf
- Thymeleaf Introduction
- Thymeleaf Configuration
- Template Resolution
- th:text
- th:if
- th:each
- th:href
- th:src
- th:value
- th:object
- th:field
- Form Binding
- Thymeleaf Validation
- Thymeleaf Fragments
- Layouts
- Thymeleaf Security Integration
- Mini Project: Product Table Rendered by Thymeleaf
Spring MVC Testing
- Unit Testing
- Controller Testing
- Service Testing
- Integration Testing
- JUnit
- Mockito
- MockMvc
- @WebMvcTest
- @SpringBootTest
- Controller Mocking
- Request Testing
- Response Testing
- Exception Testing
- Validation Testing
- Security Testing
- Mini Project: MockMvc Assertions: What You Can Check
Logging & Monitoring
- SLF4J
- Logback
- Request Logging
- Response Logging
- Exception Logging
- Correlation ID
- MDC
- Performance Logging
- Actuator Integration
- Health Monitoring
- Metrics
- Mini Project: Access Log, Request IDs and Request Metrics
Advanced Spring MVC
- Custom HandlerMapping
- Custom HandlerAdapter
- Custom ViewResolver
- Custom Argument Resolver
- HandlerMethodArgumentResolver
- Custom Return Value Handler
- HandlerMethodReturnValueHandler
- Custom Formatter
- Custom Converter
- Custom Interceptor
- Custom Exception Resolver
- Custom Message Converter
- Custom Annotation
- Request Lifecycle Customization
- Mini Project: Asynchronous Requests: Callable, DeferredResult and Server-Sent Events
Spring MVC Architecture & Design Patterns
- Front Controller Pattern
- MVC Pattern
- Dependency Injection
- IoC
- Singleton
- Factory Pattern
- Strategy Pattern
- Proxy Pattern
- Template Method Pattern
- Repository Pattern
- Service Layer Pattern
- DTO Pattern
- DAO Pattern
- PRG Pattern
- Mini Project: MVC Extension Points: Argument Resolver and Response Envelope
Performance Optimization
- MVC Performance
- Request Processing Optimization
- Database Optimization
- Connection Pooling
- Caching
- HTTP Caching
- Response Compression
- Static Resource Optimization
- Async Request Processing
- Callable
- DeferredResult
- WebAsyncTask
- Streaming Response
- Thread Pool Management
- Mini Project: Caching and Smaller Responses
Production & Enterprise Spring MVC
- Production Configuration
- Environment Profiles
- Security Configuration
- Centralized Exception Handling
- API Logging
- Audit Logging
- Monitoring
- Health Checks
- Performance Monitoring
- Rate Limiting
- Request Tracing
- Graceful Error Handling
- Production Deployment
- Load Balancing
- Reverse Proxy
- Nginx + Spring MVC
- Tomcat Configuration
- Mini Project: A Hardened API: Rate Limit, Problem Details, Security Headers
Spring MVC Interview Topics
- Spring MVC Architecture
- DispatcherServlet
- DispatcherServlet Request Flow
- HandlerMapping
- HandlerAdapter
- ViewResolver
- Model vs ModelMap vs ModelAndView
- @Controller vs @RestController
- @RequestMapping vs @GetMapping
- @RequestParam vs @PathVariable
- @RequestBody vs @ModelAttribute
- Filter vs Interceptor
- @ControllerAdvice vs @ExceptionHandler
- @Valid vs @Validated
- ResponseEntity
- HttpMessageConverter
- Jackson
- Content Negotiation
- CORS
- CSRF
- Session vs Stateless
- MVC vs REST
- Spring MVC vs Spring Boot
- Spring MVC vs Spring WebFlux
- Synchronous vs Asynchronous Request Processing
- Mini Project: Interview Trap Pack: Run the Answers