spring-->AOP

 

 使用AOP植入,需要导入依赖包

<!-- https://mvnrepository.com/artifact/org.aspectj/aspectjweaver -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.9.8</version>
<scope>runtime</scope>
</dependency>

 aop配置是的beans.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.xsd">

</beans>
beans.xml中aop的配置方式:
方式一:api接口实现

 

方式二:自定义文件实现

 

 

 方式三:使用注解

 

 

 

posted on 2022-03-13 11:05  微笑阿凡达  阅读(45)  评论(0)    收藏  举报