Skip to main content

Custom Return Value Handler

Learn Custom Return Value Handler (Advanced Spring MVC, Spring MVC) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Fresher Notes Custom return value handler processes a controller result of your own type and writes the response, so controllers can simply return a domain object such as a report. Steps : implement HandlerMethodReturnValueHandler and register it in WebMvcConfigurer.addReturnValueHandlers . Mark handled : call mavContainer.setRequestHandled(true) when you wrote the response, so no view is looked up.

More lessons in Advanced Spring MVC