Spring + Spring Security + hasPermission Not working

前端 未结 1 618
别那么骄傲
别那么骄傲 2021-01-15 12:14

I am trying to use Spring Security 3 with Struts 2 and Spring DI. I put hasRole() annotation in my code and it is working fine but hasPermission() annotation is not working.

相关标签:
1条回答
  • 2021-01-15 12:51

    It does not work, because Spring AOP can only incercept calls between beans, but not if you invoke a method of the same bean.

    So either you move the isAccessible Method to an other bean, or use use AspectJ instead of Spring Proxy AOP.

    An other idea would be using the permission evaluation directly, instead of having the annotated method. (But I do not know exactly how this can be done.)

    0 讨论(0)
提交回复
热议问题