Skip to main content

@CookieValue

Learn @CookieValue (Request Handling, Spring MVC) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Fresher Notes @CookieValue binds the value of a named request cookie to a controller method parameter, for example @CookieValue("theme") String theme . Required by default : a missing cookie gives 400 ( MissingRequestCookieException ); use required = false or defaultValue . Type conversion applies, so you can bind int , boolean or Optional<String> .

More lessons in Request Handling