Apache Shiro:如何在混合中添加新的注释方法拦截器?

问题描述

我正在看这门课:https://shiro.apache.org/static/1.3.1/xref/org/apache/shiro/spring/security/interceptor/AopAllianceAnnotationsAuthorizingMethodInterceptor.html

它正在注册所有与 Shiro 一起工作的方法拦截器。其中有这个拦截器:

PermissionAnnotationMethodInterceptor . 我想创建自己的自定义拦截器并将其集成到 Shiro 模型中。 我自己的拦截器将替换现有的 PermissionAnnotationMethodInterceptor

如何以干净的编程式 Spring Boot 方式执行此操作?

解决方法

您应该能够用您自己的实现替换 AuthorizationAttributeSourceAdvisor bean

或者随心所欲地实现自己的注释并禁用 Shiro 的注释处理:shiro.annotations.enabled=false