<?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:p="http://www.springframework.org/schema/p"
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.xsd">
<!-- 实例化业务类的Bean -->
<bean id="productService" class="com.ssm.service.impl.ProductServiceImpl"></bean>
<!-- 实例化日志通知/增强处理(切面)的Bean -->
<bean id="allLogAdvice" class="com.ssm.aop.AllLogAdvice" />
<!-- 配置aop -->
<aop:config>
<!-- 配置日志切面 -->
<aop:aspect id="logaop" ref="allLogAdvice">
<!-- 定制切入点,可采用正则表达式,含义是对browse方法,进行拦截 -->
<aop:pointcut expression="execution(public void browse(String,String))" id="logpointcut"/>
<!-- expression="execution(* com.ssm.service.*.*(..))" -->
<!-- 将日志通知类中的myBeforeAdvice方法指定为前置通知 -->
<!-- <aop:before method="myBeforeAdvice" pointcut-ref="logpointcut"/> -->
<!-- 将日志通知类中的myAfterReturnAdvice方法指定为返回通知 -->
<!-- <aop:after-returning method="myAfterReturnAdvice" pointcut-ref="logpointcut"/> -->
<!-- 将日志通知类中的myThrowingAdvice方法指定为异常通知 -->
<!-- <aop:after-throwing method="myThrowingAdvice" pointcut-ref="logpointcut" throwing="e"/> -->
<!-- 将日志通知类中的myAroundAdvice方法指定为环绕通知 -->
<aop:around method="myAroundAdvice" pointcut-ref="logpointcut"/>
</aop:aspect>
</aop:config>
</beans>
SSM之Spring+SpringMVC+Mybatis代码摘记:applicationContext5
猜你喜欢
转载自blog.csdn.net/qq_37769323/article/details/104054734
今日推荐
周排行