title: Constructor of Spring Session Scope Bean is invoked during Startup and Twice
body: <p>Based on Spring <a href="http://static.springsource.org/spring/docs/3.2.x/spring-framework-reference/html/aop.html#aop-proxying" rel="nofollow">manual</a>,</p>
  
  <blockquote>
    <p>The constructor of your proxied object will be called <strong>twice</strong>. This is a
    natural consequence of the CGLIB proxy model whereby a subclass is
    generated for each proxied object. For each proxied instance, two
    objects are created: the actual proxied object and an instance of the
    subclass that implements the advice.</p>
  </blockquote>
  
  <p>I have a class which is session scope. I observed the constructor is called <strong>first time during application startup</strong>, even there is no HTTPSession. The second time is during a HTTPSession is created. How could I delay the bean instantiation with <code>ScopedProxyMode.TARGET_CLASS</code> only if there is a session? I have tried annotated with <code>@Lazy</code> but has no effect.  </p>
  
  <pre><code>@Component
  @Scope(value="session", proxyMode=ScopedProxyMode.TARGET_CLASS)
  public class WorkspaceImpl implements Workspace, Serializable {
  </code></pre>