title: spring-mvc when to use @CookieValue
body: <p>In a controller when should you use @CookieValue ? <br>Only when you know that you are sure that the cookie will be present ?</p>
  
  <p>I have this controller:</p>
  
  <pre><code>@Controller
  @RequestMapping("my")
  public class MyController {
  
  
      @RequestMapping("")
      public ModelAndView index(@CookieValue("myCookie") String cookie,
                          Map&lt;String, Object&gt; model){
  
       log.info("My cookie {}", cookie);
  
       (...)
  }
  </code></pre>
  
  <p>When the cookie is set, no problem the method is called, but when the cookie is not set the method is not called and I think I can not have another method in my controller mapped to the same path.</p>
  
  <p>(my version of Spring: 3.2.3)</p>