【发布时间】:2016-08-13 12:32:04
【问题描述】:
我目前正在尝试使用 vaadin.spring 的 ViewAccessControl 接口,如this 教程的最后一段中所述。
但是在实现 isAccessGranted 方法时,出现以下错误:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'frontPageView': 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
FrontPageView 类的声明(我在 enter 方法中唯一做的就是添加一些 vaadin ui 元素):
@SpringView(name = FrontPageView.NAME)
public class FrontPageView extends DashboardDesign implements View, ViewAccessControl {
@Override
public void enter(ViewChangeEvent event) {
}
}
还有我对 isAccessGranted 方法的实现:
@Override
public boolean isAccessGranted(UI ui, String beanName) {
return SecurityContextHolder.getContext().getAuthentication().isAuthenticated();
}
附:这家伙一年前遇到的问题基本相同:How to create a secure view with Vaadin and SpringViewProvider
【问题讨论】:
标签: spring spring-security spring-boot vaadin vaadin4spring