title: How to end the session in spring 3
body: <p>I am using <code>@SessionAttributes</code> in spring, but I don't know how to end the session, I tried the below code but I am getting error, Please give me some example.</p>
  <p>Thanks.</p>
  <pre><code>@RequestMapping(value = &quot;/LogoutAction&quot;)
  public String logout(HttpServletRequest request) {
      Resource res = new ClassPathResource(&quot;spring-context.xml&quot;);
      BeanFactory factory = new XmlBeanFactory(res);
      HttpSession session = request.getSession();
      session.invalidate();
      return &quot;Login&quot;;
  }
  </code></pre>