title: How to create a form login with Spring Framework on Google App Engine
body: <p>I'm new to Spring and GAE, and I assume this is easy, so don't overlook the simple answer.</p>
  
  <p>In spring I understand that I need to create an implementation of <code>UserDetailsService</code> which populates <code>UserDetails</code> for the security framework on authentication.</p>
  
  <p>After doing this I got a <code>NotSerializableException</code> on my <code>SpringUserDetailsService</code> bean, if I serialize it (as shown) I get a <code>NotSerializableException</code> on the DAO eventually. GAE stores the session in a data store, and as far as I understand from reading Spring Web Security framework uses the session. </p>
  
  <p>If I add <code>@Scope("session)</code> to my service I got the following exception that I don't understand really. Also it doesn't seem to make sense to make a separate copy of this class for each session, they should all just reference the singleton.</p>
  
  <blockquote>
    <p>BeanCreationException: Error creating
    bean with name 'testService': Scope
    'session' is not active for the
    current thread; consider defining a
    scoped proxy for this bean if you
    intend to refer to it from a
    singleton; nested exception is
    java.lang.IllegalStateException: No
    thread-bound request found: Are you
    referring to request attributes
    outside of an actual web request, or
    processing a request outside of the
    originally receiving thread? If you
    are actually operating within a web
    request and still receive this
    message, your code is probably running
    outside of
    DispatcherServlet/DispatcherPortlet:
    In this case, use
    RequestContextListener or
    RequestContextFilter to expose the
    current request.</p>
  </blockquote>
  
  <pre><code>@Service("springUserDetailsService")
  public class SpringUserDetailsService implements UserDetailsService, Serializable {
   @Resource(name="userDao")
   private IUserDao userDao;
  
      @Override
      public UserDetails loadUserByUsername(String username){...}
  }
  </code></pre>
  
  <p>For an easy task like form login, this is kicking my butt, can anyone help untangle my brain?</p>