1.建好工程后,先引入依赖
?
<dependencies>
<!--单元测试-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.4</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.0.5.RELEASE</version>
</dependency>
<!--spring test-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>4.3.15.RELEASE</version>
</dependency>
</dependencies>
2.搭建项目结构,我的项目结构如下
?3.接口里写了一个save方法
?target类里实现了接口,并输出了一句话
?切面类写了一个before方法
?4.applicationContext.xml
?
?5.测试
新建AopTest
?
?
|