【发布时间】:2018-09-11 08:31:06
【问题描述】:
我的 Spring MVC 项目使用 Apache Shiro 运行以实现 Web 和 api 安全性。生活是美好的,直到有一天我不得不为授权做权限检查。
使用@RequiresPermissions 注释需要我使用以下代码启用 Spring AOP:
<bean id="annotationProxy" class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator" depends-on="lifecycleBeanPostProcessor"/>
<bean class="org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor">
<property name="securityManager" ref="securityManager"/>
</bean>
现在运行项目时出现如下错误:
[http-nio-8084-exec-66] WARN org.springframework.web.context.support.XmlWebApplicationContext - 上下文初始化期间遇到异常 - 取消刷新尝试:org.springframework.beans.factory.UnsatisfiedDependencyException:创建 bean 时出错名称为“myController”:通过字段“myService”表示的不满足的依赖关系;嵌套异常是 org.springframework.beans.factory.BeanNotOfRequiredTypeException:名为“myService”的 Bean 应该是 [com.service.myService] 类型,但实际上是 [com.sun.proxy.$Proxy594] 类型 [http-nio-8084-exec-66] 错误 org.springframework.web.context.ContextLoader - 上下文初始化失败 org.springframework.beans.factory.UnsatisfiedDependencyException:创建名为“myController”的bean时出错:通过字段“myService”表达的依赖关系不满足;嵌套异常是 org.springframework.beans.factory.BeanNotOfRequiredTypeException:名为“myService”的 Bean 应该是 [com.service.myService] 类型,但实际上是 [com.sun.proxy.$Proxy594] 类型
请帮忙。
【问题讨论】:
标签: java spring-mvc spring-aop shiro