3

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

Wojciech Wirzbicki
  • 3,887
  • 6
  • 36
  • 59
Juan Rojas
  • 8,711
  • 1
  • 22
  • 30

1 Answers1

0

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

Adri
  • 1