title: Vaadin error "Scope 'vaadin-view' is not active for the current thread"
body: <p>I'm trying to create Vaadin 7.5.5 app with add-on com.vaadin.vaadin-spring.1.0.0. This is not Spring Boot app, but deploy-able war with Spring context which should bootstrap Vaadin.</p>
  <p>The error is:</p>
  <blockquote>
  <p>Scope 'vaadin-view' is not active for the current thread</p>
  <p>nested exception is java.lang.IllegalStateException: No active view</p>
  </blockquote>
  <p>Here is full error trace:</p>
  <pre><code>2015-09-25 21:27:33 DEBUG DefaultListableBeanFactory:448 - Creating instance of bean 'vaadinSpringApplication'
  2015-09-25 21:27:33 DEBUG InjectionMetadata:72 - Registered injected element on class [com.myapp.vaadin.demo.VaadinSpringApplication]: AutowiredFieldElement for com.vaadin.spring.navigator.SpringViewProvider com.myapp.vaadin.demo.VaadinSpringApplication.viewProvider
  2015-09-25 21:27:33 DEBUG InjectionMetadata:72 - Registered injected element on class [com.myapp.vaadin.demo.VaadinSpringApplication]: AutowiredFieldElement for com.myapp.vaadin.demo.DefaultView com.myapp.vaadin.demo.VaadinSpringApplication.defaultView
  2015-09-25 21:27:33 DEBUG InjectionMetadata:72 - Registered injected element on class [com.myapp.vaadin.demo.VaadinSpringApplication]: AutowiredFieldElement for com.myapp.vaadin.demo.SpringLoginView com.myapp.vaadin.demo.VaadinSpringApplication.springLoginView
  2015-09-25 21:27:33 DEBUG InjectionMetadata:72 - Registered injected element on class [com.myapp.vaadin.demo.VaadinSpringApplication]: AutowiredFieldElement for com.myapp.vaadin.demo.SpringMainView com.myapp.vaadin.demo.VaadinSpringApplication.springMainView
  2015-09-25 21:27:33 DEBUG InjectionMetadata:86 - Processing injected element of bean 'vaadinSpringApplication': AutowiredFieldElement for com.vaadin.spring.navigator.SpringViewProvider com.myapp.vaadin.demo.VaadinSpringApplication.viewProvider
  2015-09-25 21:27:33 DEBUG DefaultListableBeanFactory:250 - Returning cached instance of singleton bean 'viewProvider'
  2015-09-25 21:27:33 DEBUG AutowiredAnnotationBeanPostProcessor:490 - Autowiring by type from bean name 'vaadinSpringApplication' to bean named 'viewProvider'
  2015-09-25 21:27:33 DEBUG InjectionMetadata:86 - Processing injected element of bean 'vaadinSpringApplication': AutowiredFieldElement for com.myapp.vaadin.demo.DefaultView com.myapp.vaadin.demo.VaadinSpringApplication.defaultView
  2015-09-25 21:27:33 DEBUG DefaultListableBeanFactory:448 - Creating instance of bean 'viewCache'
  2015-09-25 21:27:33 DEBUG DefaultListableBeanFactory:250 - Returning cached instance of singleton bean 'com.vaadin.spring.VaadinConfiguration'
  2015-09-25 21:27:33 DEBUG CommonAnnotationBeanPostProcessor:216 - Found destroy method on class [com.vaadin.spring.internal.DefaultViewCache]: void com.vaadin.spring.internal.DefaultViewCache.destroy()
  2015-09-25 21:27:33 DEBUG CommonAnnotationBeanPostProcessor:288 - Registered destroy method on class [com.vaadin.spring.internal.DefaultViewCache]: org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement@5cd39ffa
  2015-09-25 21:27:33 DEBUG DefaultListableBeanFactory:484 - Finished creating instance of bean 'viewCache'
  Sep 25, 2015 9:27:33 PM com.vaadin.server.DefaultErrorHandler doDefault
  SEVERE: 
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'vaadinSpringApplication': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.myapp.vaadin.demo.DefaultView com.myapp.vaadin.demo.VaadinSpringApplication.defaultView; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultView': Scope 'vaadin-view' 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 active view
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
      at org.springframework.beans.factory.support.AbstractBeanFactory$2.getObject(AbstractBeanFactory.java:344)
      at com.vaadin.spring.internal.BeanStore.create(BeanStore.java:71)
      at com.vaadin.spring.internal.UIScopeImpl$UIBeanStore.create(UIScopeImpl.java:279)
      at com.vaadin.spring.internal.BeanStore.get(BeanStore.java:62)
      at com.vaadin.spring.internal.SessionLockingBeanStore.get(SessionLockingBeanStore.java:46)
      at com.vaadin.spring.internal.UIScopeImpl.get(UIScopeImpl.java:81)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:339)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:219)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:351)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:332)
      at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1057)
      at com.vaadin.spring.server.SpringUIProvider.createInstance(SpringUIProvider.java:172)
      at com.vaadin.server.communication.UIInitHandler.getBrowserDetailsUI(UIInitHandler.java:191)
      at com.vaadin.server.communication.UIInitHandler.synchronizedHandleRequest(UIInitHandler.java:74)
      at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:41)
      at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1408)
      at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:351)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
  </code></pre>
  <p>Here is application main class:</p>
  <pre><code>@Theme(&quot;valo&quot;)
  @SpringUI
  public class VaadinSpringApplication extends UI {
  
      @Configuration
      @EnableVaadin
      public static class VaadinSpringApplicationConfiguration {}
      
      @Autowired
      SpringViewProvider viewProvider;
  
      @Override
      protected void init(VaadinRequest request) {
          Navigator navigator = new Navigator(this, this);
          navigator.addProvider(viewProvider);
          navigator.navigateTo(DefaultView.NAME);
      }
  }
  </code></pre>
  <p>DefaultView.java</p>
  <pre><code>@SpringComponent
  @SpringView(name = DefaultView.NAME)
  public class DefaultView extends CustomComponent implements View {
  
      public static final String NAME = &quot;defaultView&quot;;
  
      @Override
      public void enter(ViewChangeListener.ViewChangeEvent event) {
          VerticalLayout layout = new VerticalLayout();
          layout.setMargin(true);
          Button button = new Button(&quot;Click Me&quot;);
          setCompositionRoot(layout);
      }
  }
  </code></pre>
  <p>As you may see from logs, spring beans (viewCache, defaultView, springLoginView, springMainView) has been created. But once I've tried to inject it into main class - got the error &quot;<strong>Scope 'vaadin-view' is not active for the current thread</strong>&quot;.</p>
  <p>Please advice. Thank you.</p>