title: Unable to deserialize Spring Session Scoped bean
body: <p>I have the following session scoped bean:</p>
  
  <pre><code>@ManagedBean
  @Component
  @Scope(proxyMode= ScopedProxyMode.TARGET_CLASS, value="session")
  public class SessionData implements Serializable {}
  </code></pre>
  
  <p>and I store tomcat sessions in a database. The problem is that, when the application tries to deserialize a stored session, I receive the following error:</p>
  
  <pre><code> org.apache.catalina.session.PersistentManagerBase.swapIn Error deserializing Session EE913D2ACAD49EB55EDA657A54DFA2CB: {1}
   java.lang.ClassNotFoundException: de.myproject.SessionData$$EnhancerBySpringCGLIB$$768b59b9
  </code></pre>
  
  <p>It seems that it serialized actually the whole Spring context, and obviously there is no such class <code>de.myproject.SessionData$$EnhancerBySpringCGLIB$$768b59b9</code> after server restarts, so I receive the aforementioned exception.</p>
  
  <p>Is there a way to avoid this, so that the session-scoped bean is serialized properly?</p>
  
  <p>UPDATE: There is an <a href="https://jira.spring.io/browse/SPR-7124" rel="noreferrer">issue</a> regards this which marked as resolved without comments, however I still face it.</p>