博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Apache Shiro 使用 RequiresPermissions with Spring...
阅读量:7010 次
发布时间:2019-06-28

本文共 752 字,大约阅读时间需要 2 分钟。

hot3.png

Via:

根据官方文档在启用Shiro 注解(例如,@RequiresRoles,@RequiresPermissions 等等)时,

需要Shiro 的Spring AOP 集成来扫描合适的注解类以及执行必要的安全逻辑。
只需添加这两个bean 定义到applicationContext-shiro.xml 中:

但是,在使用Spring MVC 的情况下,会遇到:

Exception: org.hibernate.HibernateException: No Session found for current thread

解决方法:

将以上代码移至Spring MVC 的servlet 配置文件,如:applicationContext-servlet.xml

    
    
    
    
    
        
    
    
        
            
                
/403
            
        
    

转载于:https://my.oschina.net/keywindy/blog/111244

你可能感兴趣的文章