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

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 {
    public void onStartup(javax.servlet.ServletContext servletContext)
            throws ServletException {
        AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
        context.register(MainUI.class, PersistenceJPAConfig.class);
        servletContext.addListener(new ContextLoaderListener(context));

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

This is the relevant part from MainUi


public class MainUI extends UI  {

	private final SpringViewProvider viewProvider;

	private final NavigationManager navigationManager;

	private final MainView mainView;

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