How to create a secure view with Vaadin and SpringViewProvider

不打扰是莪最后的温柔 提交于 2020-01-02 07:13:04

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!