Using @SpringUI (without spring boot) got exception HTTP Status 500 - com.v

I’m trying to use vaadin-spring 3.0.0 without spring boot and I’ve followed the tutorial on
http://vaadin.github.io/spring-tutorial/#_using_a_webapplicationinitializer

I have a multi module project and using WebApplicationInitializer @Config are loaded .

MainUi has @SpringUI annotation, someone could tell me why vaadin ui cannot be instantiated ?

MainUi has a constructor with @Autowired that seems to be ignored

Moreover if I did not add the following line in registerServlet

dispatcher.setInitParameter(VaadinSession.UI_PARAMETER, MainUI.class.getName());

I got a different exception

HTTP Status 500 - com.vaadin.server.ServiceException: java.lang.IllegalStateException: No Scope registered for scope name 'vaadin-u

public class WebContextInitializer implements WebApplicationInitializer {
    @Override
    public void onStartup(javax.servlet.ServletContext servletContext)
            throws ServletException {
        AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
        context.register(MainUI.class, PersistenceJPAConfig.class);
        servletContext.addListener(new ContextLoaderListener(context));
        registerServlet(servletContext);
    }

    private void registerServlet(ServletContext servletContext) {
        ServletRegistration.Dynamic dispatcher = servletContext.addServlet(
                "vaadin", SpringVaadinServlet.class);
        dispatcher.setLoadOnStartup(1);
        dispatcher.addMapping("/*");
        dispatcher.setInitParameter(VaadinSession.UI_PARAMETER, MainUI.class.getName());
    }
}

This is the relevant part from MainUi

@Viewport("user-scalable=no,initial-scale=1.0")
@Theme("mytheme")
@SpringUI
@Widgetset("xxx.MyAppWidgetset")
@SuppressWarnings("serial")

public class MainUI extends UI  {

	@Autowired
	private final SpringViewProvider viewProvider;

	@Autowired
	private final NavigationManager navigationManager;

	@Autowired
	private final MainView mainView;

	@Autowired
	public MainUI(SpringViewProvider viewProvider, NavigationManager navigationManager, MainView mainView) {
		this.viewProvider = viewProvider;
		this.navigationManager = navigationManager;
		this.mainView = mainView;
	}