Spring课程 Spring入门篇 5-3 配置切入点 pointcut

1    解析

1.1  xml常见的配置切入点写法

2    代码演练

2.1  xml配置切入点

 

1    解析

1.1  xml常见的配置切入点写法

 

2    代码演练

2.1  xml配置切入点

xml配置:

<?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:aop="http://www.springframework.org/schema/aop" 
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-4.0.xsd">


<bean id = "logAspect" class = "com.imooc.aop.schema.advice.LogAspect"></bean>
<bean id = "AspectBiz" class = "com.imooc.aop.schema.advice.biz.AspectBiz"></bean>

<aop:config>
    <aop:aspect  id="moocAspectAOP" ref="logAspect">
<!--     声明切入点:从哪里开始执行-->
<!--     执行com.imooc.aop.schema.advice.biz包下的所有Biz结尾的java类中的所有方法时 -->
        <aop:pointcut expression="execution(*com.imooc.aop.schema.advice.biz.*Biz.*(..))" id="moocPointCut"/>
    </aop:aspect>
</aop:config>

</beans>

切入面:

package com.imooc.aop.schema.advice;

public class MoocAspect {

}

切入对象:

package com.imooc.aop.schema.advice.biz;

public class AspectBiz {

}

猜你喜欢

转载自www.cnblogs.com/1446358788-qq/p/10681026.html