初学者spring aop/tx配置出现问题不会

图片说明

错误信息:
Multiple annotations found at this line:
- schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/context/spring-beans.xsd', because 1) could not find the document; 2) the document could
not be read; 3) the root element of the document is not xsd:schema.
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'context:annotation-config'.

Multiple annotations found at this line:
- schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/tx/spring-beans.xsd', because 1) could not find the document; 2) the document could not be 
 read; 3) the root element of the document is not <xsd:schema>.
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'tx:advice'.

前面引用的改写成下面试试

 <?xml version="1.0" encoding="UTF-8"?>  
<beans xmlns="http://www.springframework.org/schema/beans"  
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"  
    xmlns:aop="http://www.springframework.org/schema/aop"  
    xsi:schemaLocation="    
           http://www.springframework.org/schema/beans    
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd    
           http://www.springframework.org/schema/aop    
           http://www.springframework.org/schema/aop/spring-aop-3.0.xsd  
           http://www.springframework.org/schema/context    
           http://www.springframework.org/schema/context/spring-context-3.0.xsd">  

    <!-- 指定自动搜索bean组件、自动搜索切面类 -->  
        <context:component-scan base-package="com.mucfu"/>  
    <!-- 启动@AspectJ支持 -->  
    <!-- proxy-target-class默认"false",更改为"ture"使用CGLib动态代理 -->    
    <aop:aspectj-autoproxy proxy-target-class="false"/>  


</beans>  

可 以参考下我写的
http://blog.csdn.net/evankaka/article/details/45242505

首先你要明白一些概念

•横切性关注点
–是一种独立的服务,它遍布在各个流程中。
–独立服务:和正常的业务逻辑没有任何关系
–独立服务:安全验证、事务处理、日志
•Aspect:切面
–横切性关注点的模块化(.java)
•Advice:BeforeAdive、AfterAdvice、AroundAdvice、ThrowAdvice
–切面中具体的实现(安全验证代码)
•Pointcut:
–Advice应用到哪些JoinPoint上,save*、delete*、update*
•Joinpoint:
–Advice应到的某个具体方法
•Weave:
–把Advice应用JointPoint上的过程,就叫织入