shiro用户授权的时候

在springmvc.xml配置出现The prefix "aop" for element "aop:config" is not bound.
在对系统类的方法进行给用户授权的时候,在springmvc.xml配置文件中加入
 
    
  1. <!-- 开启aop,对类代理 -->
  2. <aop:config proxy-target-class="true"></aop:config>
  3. <!-- 开启shiro注解支持 -->
  4. <bean
  5. class="org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor">
  6. <property name="securityManager" ref="securityManager" />
  7. </bean>
发现报错:
 
  
  1. The prefix "aop" for element "aop:config" is not bound.
原因:定义申明AOP的时候。没有加载schema。
解决方法:
首先应该加载JAR包。
还要在<beans>中要加入“xmlns:aop”的命名申明,并在“xsi:schemaLocation”中指定aop配置的schema的地址

配置文件如下:

 
    
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans "
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance "
  4. xmlns:aop="http://www.springframework.org/schema/aop "
  5. xmlns:tx="http://www.springframework.org/schema/tx "
  6. xsi:schemaLocation="http://www.springframework.org/schema/beans
  7. http://www.springframework.org/schema/beans/spring-beans.xsd
  8. http://www.springframework.org/schema/tx
  9. http://www.springframework.org/schema/tx/spring-tx.xsd
  10. http://www.springframework.org/schema/aop
  11. http://www.springframework.org/schema/aop/spring-aop.xsd ">

猜你喜欢

转载自blog.csdn.net/architect_csdn/article/details/80253098