`
JavaStudyEye
  • 浏览: 79669 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

struts2与shiro集成(实例)

 
阅读更多
近日,看到了,我心中 “框架之神” 江南白衣的springside4,颇有感触。也发现了一个很好玩,很实用,很简单的权限控制框架shiro。运行了springside4,发先用的是 springmvc。但是对于shiro集成struts2的资料咋这么难找啊。哭了都。例子在附件中,下载即可运行。没有用 maven。

集成的时候说明几点:
1、jar包不能少。参考帖子:http://stackoverflow.com/questions/7743749/shiro-authorization-permission-check-using-annotation-not-working

另外为了防止这个连接失效,我把答案也贴过来:
You were absolutely right. After seeing your comment, I started giving it a thought. Well then I found out that it was NOT an implementation problem with Shiro, but the jar dependecies were not properly configured. Shiro's pom.xml should have dependency for cglib2 too.

So the below changes worked for me :

    Include all these four jar files.

        aspectjrt-1.6.11.jar,
        aspectjweaver-1.6.12.jar,
        cglib-2.2.2.jar,
        asm-3.3.1.jar,


2、需要使用struts2的 annotations,说实话,struts2的xml配置,关于shiro方法级别的控制,我没有找到解决方法,反正就是注解失效,页面控制和url控制可以通过。

3、shiro的filter应该放在struts2的 filter的上面。



最后,奉献出代码,代码有一部分引用 白衣的部分代码了。另外参考了官网。希望和我一样的初学者,少走弯路吧。lib最简。
分享到:
评论
6 楼 MSNS_ 2016-09-26  
为什么我下载不了啊,534522980,能把这个struts2和 shiro集成发到我邮箱吗?
5 楼 jethypc 2016-03-04  
吐个槽 你说你项目叫struts2shiro  然后的域名却叫FileUploadStruts ....
4 楼 wnagyf0309 2014-12-12  
好感谢
正在 发愁呢
3 楼 coolcaosj 2014-05-08  
2、需要使用struts2的 annotations,说实话,struts2的xml配置,关于shiro方法级别的控制,我没有找到解决方法,反正就是注解失效,页面控制和url控制可以通过。 
这句话是什么意思,是说在action的方法上使用shiro的注解吗,确实,我在action的方法上使用shiro的注解后,报异常,NoSuchMethodException ,不知道现在这个问题你解决没,交流一下
2 楼 thunderbird521 2013-08-08  

    struts2shiro.7z (9.4 MB)
    下载次数: 476
-- 您好,我也在用struts和shiro,现在
   这个附件在iteye下载不了,您方便发个邮件给我吗? dx0116@163.com,不胜感激
1 楼 gaoxingang2008 2012-11-22  
shiro的filter应该放在struts2的 filter的上面。 找了半天

相关推荐

Global site tag (gtag.js) - Google Analytics