<?xml version="1.0" encoding="UTF-8"?>
<bean id="accountService" class="com.itheima.service.impl.AccountService"></bean>
<bean id="logger" class="com.itheima.utils.Logger"></bean>
<!-- 1、将通知的bean导入给spring来管理
2、使用给aop:config 表明开始了 aop 配置
3、使用 aop:aspect 标签表面切面
id属性:给切面提供一个唯一标识
ref属性:指定通知类的bean的id
4、aop:aspect 配置通知类型
aop:before
pointcut 属性:用于指定切入点表达式,对业务层的哪些方法增强 ,
public void com.itheima.service.impl.AccountServiceImpl.saveAccount()
访问修饰符可以省略
void com.itheima.service.impl.AccountServiceImpl.saveAccount()
返回值可以使用通配符
* com.itheima.service.impl.AccountServiceImpl.saveAccount()
包名可以使用通配符,有几个包写几个
全通配写法
* *..*.*(..)
切到业务层实现类
* com.itheima.service.impl.*.*(..)
-->
<aop:config>
<aop:aspect id="logAdvice" ref="logger">
<aop:before method="printLog" pointcut="execution(public void com.itheima.service.impl.AccountService.saveAccount())"></aop:before>-->
<aop:before method="printLog" pointcut="execution( * *..*.*(..))"></aop:before>
</aop:aspect>
</aop:config>