Spring aop
aop思想 在一个执行一个方法时如果我们想要在执行方法前后者后增加其他的方法,这时我们就需要去修改原方法的代码十分的麻烦。由此我们引入aop 执行aop的三种方法 使用xml文档 1如果想要在方法前执行创建一个类并且继承MethodBeforeAdvice 如果想要在方法后执行创建一个类并且继承AfterReturningAdvice 2在xml文件中编写对应的bean和aop, <aop:config> <aop:pointcut id="UserPointCut" expression="execution(* com.xxr.mapper.Impl.UserImpl.*(..))"></aop:pointcut> <aop:advisor advice-ref="After" pointcut-ref="UserPointCut"></aop:advisor> <aop:advisor advice-ref="Befor" pointcut-ref="UserPointCut"></aop:advisor> </aop:config> 第二种方式 编写一个要插入的实体类在xml文件注册即可 编写对应的aop <aop:config> <aop:aspect ref="BATest"> <aop:pointcut id="BA" expression="execution(*