如何动态添加spring视图

问题描述 投票:1回答:1

我想有条件地添加春天视图。无法找到办法做到这一点。有人可以帮助我。

前 - 我有2个视图如下,基于已登录的用户,我想只显示其中一个,另一个即使通过像http://localhost:7071/#!view2这样的网址也不可用

@SpringView(name = "view1")
public class View1 extends VerticalLayout { ... }

@SpringView(name = "view2")
public class View2 extends VerticalLayout { ... }
vaadin
1个回答
0
投票

使用这样的安全控制:

import org.apache.shiro.authz.annotation.RequiresRoles;

@SpringView(name = "view1")
@RequiresRoles(value = "ROLE1")
public class View1 extends VerticalLayout { ... }

@SpringView(name = "view2")
@RequiresRoles(value = "ROLE2")
public class View2 extends VerticalLayout { ... }
© www.soinside.com 2019 - 2024. All rights reserved.