Usually, extensions provide constructor that receives UI component to extend, but this extensions for some reason doesn’t. That’s why we have to extend AppUI class.
I also have similar problem when using vaadin add-on. I noticed that you have bean scope configured to ‘vaadin’, but when I configure the same, it works as the same as ‘singleton’. Question is, do we really have ‘vaadin’ bean scope, is there any other special bean scopes in CUBA?
Additionally, singleton scope won’t allow me to open another tab in browser for the same app, only prototype scope could do. I think for AppUI, we should use prototype. I’m using CUBA 6.9.5.
Custom UI class should always be declared in prototype scope, because default AppUI is defined there. It is our internal scope for beans bound to VaadinSession.
Could you please explain the code in com.haulmont.cuba.web.AppUI.java in v6.9.5, it is prototype bean, am i messing something?
/**
* Single window / page of web application. Root component of Vaadin layout.
*/
@org.springframework.stereotype.Component(AppUI.NAME)
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
@Push(transport = Transport.WEBSOCKET_XHR)
@PreserveOnRefresh
public class AppUI extends UI implements ErrorHandler, CubaHistoryControl.HistoryBackHandler {
public static final String NAME = "cuba_AppUI";
public static final String LAST_REQUEST_ACTION_ATTR = "lastRequestAction";
public static final String LAST_REQUEST_PARAMS_ATTR = "lastRequestParams";