1 <properties> 2 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 3 <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> 4 <!-- spring版本号 --> 5 <spring.version>4.2.4.RELEASE</spring.version> 6 </properties> 7 <dependencies> 8 <!-- 添加spring核心依赖 --> 9 <dependency> 10 <groupId>org.springframework</groupId> 11 <artifactId>spring-core</artifactId> 12 <version>${spring.version}</version> 13 </dependency> 14 <dependency> 15 <groupId>org.springframework</groupId> 16 <artifactId>spring-context</artifactId> 17 <version>${spring.version}</version> 18 </dependency> 19 <dependency> 20 <groupId>org.springframework</groupId> 21 <artifactId>spring-context-support</artifactId> 22 <version>${spring.version}</version> 23 </dependency> 24 <dependency> 25 <groupId>org.springframework</groupId> 26 <artifactId>spring-aop</artifactId> 27 <version>${spring.version}</version> 28 </dependency> 29 30 <dependency> 31 <groupId>org.springframework</groupId> 32 <artifactId>spring-aspects</artifactId> 33 <version>${spring.version}</version> 34 </dependency> 35 </dependencies>
引入依赖后maven dependencies如下:
引入 spring-aspects 的依赖后,自动引入aspectjweaver-1.8.7这个jar包。
在进行aop测试的时候发生下面的exception:
java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException
原因:
没有引入 spring-aspects 的依赖或者aspectjweaver的依赖。(spring-aspects集成了AspectJ,可以引入其中任一一个依赖即可)
原文地址:https://www.cnblogs.com/mrray1105/p/8367423.html
时间: 2024-10-28 13:21:24