I had my Spring MVC project running with Apache Shiro for web and api security. Life was good, until one day I had to do permission checks for authorization.
Using @RequiresPermissions
annotation required me to enable Spring AOP with following code:
<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>
Now I get error when I run the project as follows:
[http-nio-8084-exec-66] WARN org.springframework.web.context.support.XmlWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'myController': Unsatisfied dependency expressed through field 'myService'; nested exception is org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'myService' is expected to be of type [com.service.myService] but was actually of type [com.sun.proxy.$Proxy594] [http-nio-8084-exec-66] ERROR org.springframework.web.context.ContextLoader - Context initialization failed org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'myController': Unsatisfied dependency expressed through field 'myService'; nested exception is org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'myService' is expected to be of type [com.service.myService] but was actually of type [com.sun.proxy.$Proxy594]
Please help.