shiro+thymeleaf常见问题

shiro+thymeleaf+springboot 

org.thymeleaf.exceptions.TemplateProcessingException: 
Error during execution of processor 'at.pollux.thymeleaf.shiro.processor.attribute.HasPermissionAttrProcessor'
java.lang.IllegalArgumentException: 
Wildcard string cannot be null or empty. Make sure permission strings are properly formatted.

翻译为:通配符字符串不能为空或空。确保权限字符串被正确格式化。

问题原因:

在页面中设置权限验证,在授权时,sql语句获取的权限列表中有为空的值导致报错。

select m.Perms as perms
        from user u join role_menu rm on u.RoleId= rm.RoleId
        join menu m on rm.MenuId =m.MenuId
        where u.UserID=13  and m.Perms !=""

直接不等于空字符串即可,其中 is not null 不能排除为空字符串。

你可能感兴趣的:(spring,mysql,shiro,thymeleaf)