问题
There is a tutorial about Vaadin III - Views and Navigation with Vaadin Spring
If I want to use Apache Shiro. How should I use ViewAccessControl?
@SpringComponent
@SpringView(name = SecuredView.VIEW_NAME)
public class SecuredView extends VerticalLayout implements View, ViewAccessControl {
public static final String VIEW_NAME = "view";
@PostConstruct
void init() {
addComponent(new Label("This is a secured view scoped view"));
}
@Override
public boolean isAccessGranted(UI ui, String string) {
return true;
}
}
I get the exception:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securedView': 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
回答1:
The problem is that you're trying to inject the bean in a narrow context. e.g. SpringUI : UIScope => SpringView : ViewScope Try to have a look "inside" annotation, they carry already the SpringComponent Cheers
来源:https://stackoverflow.com/questions/29481899/how-to-create-a-secure-view-with-vaadin-and-springviewprovider