Spring Security 可以在 Spring 控制器方法上使用 @PreAuthorize 吗? [英] Can Spring Security use @PreAuthorize on Spring controllers methods?
本文介绍了Spring Security 可以在 Spring 控制器方法上使用 @PreAuthorize 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Spring Security 可以在 Spring 控制器方法上使用 @PreAuthorize
吗?
Can Spring Security use @PreAuthorize
on Spring controllers methods?
推荐答案
是的,它运行良好.
您需要 ...-servlet.xml
中.它还需要 CGLIB 代理,所以要么你的控制器不应该有接口,要么你应该使用proxy-target-class = true
.
You need <security:global-method-security pre-post-annotations="enabled" />
in ...-servlet.xml
. It also requires CGLIB proxies, so either your controllers shouldn't have interfaces, or you should use proxy-target-class = true
.
这篇关于Spring Security 可以在 Spring 控制器方法上使用 @PreAuthorize 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文