title: Which scope to use with vaadin and spring?
body: <p>I'd like to develop a vaadin application with spring. A user should be able to login and see uer-specific pages. I he comes to the site from a different browser window, it would be handy if the user is still logged in, so preserves the session.</p>
  
  <p>Now I wonder which scope to use for this purpose? Vaadin and Spring offer a <code>@Scope("session")</code>, <code>@Scope("ui")</code> and a <code>@Scope("prototype")</code>. Should I just place all of my *View and *Presenter classes in the <code>session</code> scope?</p>
  
  <p>Or would it be better to have the view annoted with <code>prototype</code>, so that each time a pages is changed the page is recreated with updated data?
  In this case, should then the presenters be still session scope, or also prototye?</p>
  
  <p>Or should I at all use the <code>ui</code> scope that's provided by <code>vaadin4spring</code> boot addon? This would then create a new "uiSession" for every new tab.</p>
  
  <pre><code>@Scope("session")
  class MyPresenter {
      //each view should be wired to a presenter
      @Autowired
      private MyView view;
  }
  
  @Scope("prototype") //"session", "ui"?
  class MyView extends VerticalLayout {
      @PostConstruct
      public void init() {
          addComponent(new Label("time is: " + new Date()));
      }
  }
  </code></pre>