Vaadin 23:MainView 中的 ScopeNotActiveException,扩展了 AppLayout View
我有以下视图结构:
主页
@SpringComponent
@UIScope
@PageTitle("ExampleApp: Home Page")
@Route(value = Endpoint.UI.HOME_PAGE, layout = MainView.class)
public class HomePage extends VerticalLayout {
//the rest is ommited
}
几个像这样的其他页面和 MainView
:
@SpringComponent
@UIScope
@Push
@Viewport("width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes")
//@PWA - details ommited
@Theme(themeClass = Lumo.class, variant = Lumo.DARK)
@CssImport("./css/main_view.css")
public class MainView extends AppLayout implements BeforeEnterObserver, AppShellConfigurator {
//implementation is ommited.
}
在 Vaadin 14.8.1
应用程序中运行完美。但更新到 Vaadin 23.0.1
后,我得到:
2022-03-14T09:39:07.191902382Z org.springframework.beans.factory.support.ScopeNotActiveException: Error creating bean with name 'mainView':
Scope 'vaadin-ui' 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: There is no UI available. The UI scope is not active
问题:如何从 MainView
访问 UI 范围或对象?
I have following Views structure:
Home Page
@SpringComponent
@UIScope
@PageTitle("ExampleApp: Home Page")
@Route(value = Endpoint.UI.HOME_PAGE, layout = MainView.class)
public class HomePage extends VerticalLayout {
//the rest is ommited
}
few another pages like this and MainView
:
@SpringComponent
@UIScope
@Push
@Viewport("width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes")
//@PWA - details ommited
@Theme(themeClass = Lumo.class, variant = Lumo.DARK)
@CssImport("./css/main_view.css")
public class MainView extends AppLayout implements BeforeEnterObserver, AppShellConfigurator {
//implementation is ommited.
}
In Vaadin 14.8.1
App works perfectly. But after updating to Vaadin 23.0.1
I got:
2022-03-14T09:39:07.191902382Z org.springframework.beans.factory.support.ScopeNotActiveException: Error creating bean with name 'mainView':
Scope 'vaadin-ui' 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: There is no UI available. The UI scope is not active
Question: how do I access UI Scope or Object from MainView
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论