JSF2&x2B;Spring Security 3.1.x@Secured AccessDeniedException处理

JSF2&x2B;Spring Security 3.1.x@Secured AccessDeniedException处理,jsf,spring-security,Jsf,Spring Security,我想问一下,如何处理来自“安全注释”(@PreAuthorize、@Secured等)的AccessDeniedException(例如,捕获、记录和重定向流) 我尝试设置自己的AccessDeniedHandler: <http auto-config="true" use-expressions="true"> ... <access-denied-handler ref="myAccessDeniedHandler" /> </http>

我想问一下,如何处理来自“安全注释”(@PreAuthorize、@Secured等)的AccessDeniedException(例如,捕获、记录和重定向流)

我尝试设置自己的AccessDeniedHandler:

<http auto-config="true" use-expressions="true">
    ...
    <access-denied-handler ref="myAccessDeniedHandler" />
</http>

不是这样处理的。

这篇文章有点老了,所以我想你不再需要答案了。仍然为其他人回答这个问题:


第一:您是对的:
有关处理
@Secured
-注释的示例,是否确实正确配置了方法保护?我是说
?你确定抛出了AccessDeniedException吗?是的,我配置了它,是的,“AccessDeniedException:拒绝访问”是thrownShow你的整个spring安全配置
@PreAuthorize("hasRole('ROLE_ADMIN')")
public void myMethod(){
    System.out.println("Secret Method");
}