出现的问题解决:
问题1:Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.springframework.util.ClassUtils.<clinit>(ClassUtils.java:67) at org.springframework.core.io.DefaultResourceLoader.<init>(DefaultResourceLoader.java:52) at org.springframework.context.support.AbstractApplicationContext.<init>(AbstractApplicationContext.java:184) at org.springframework.context.support.AbstractRefreshableApplicationContext.<init>(AbstractRefreshableApplicationContext.java:80) at org.springframework.context.support.AbstractXmlApplicationContext.<init>(AbstractXmlApplicationContext.java:58) at
需要加上:commons-logging.jar log4j-1.2.11.jar
问题2:Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [text.xml]; nested exception is java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException
Caused by: java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException
at java.lang.Class.forName0(Native Method)
需要加上:aspectjweaver.jar
问题3:Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘logBean’ defined in class path resource [text.xml]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Cannot proxy target class because CGLIB2 is not available. Add CGLIB to the class path or specify proxy interfaces.
Caused by: org.springframework.aop.framework.AopConfigException: Cannot proxy target class because CGLIB2 is not available. Add CGLIB to the class path or specify proxy interfaces.
需要加上:cglib-nodep-2.2.jar
问题4:xception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘logBean’ defined in class path resource [text.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/objectweb/asm/Type
Caused by: java.lang.NoClassDefFoundError: org/objectweb/asm/Type
at net.sf.cglib.core.TypeUtils.parseType(TypeUtils.java:180)
需要加上:asm.jar
问题5: Exception in thread "main" java.lang.IllegalArgumentException: warning no match for this type name: Performer [Xlint:invalidAbsoluteTypeName]
at org.aspectj.weaver.tools.PointcutParser.parsePointcutExpression(PointcutParser.java:315)
at org.springframework.aop.aspectj.AspectJExpressionPointcut.buildPointcutExpression(AspectJExpressionPointcut.java:197)
at org.springframework.aop.aspectj.AspectJExpressionPointcut.checkReadyToMatch(AspectJExpressionPointcut.java:184)
at org.springframework.aop.aspectj.AspectJExpressionPointcut.getClassFilter(AspectJExpressionPointcut.java:165)
at org.springframework.aop.framework.DefaultAdvisorChainFactory.getInterceptorsAndDynamicInterceptionAdvice(DefaultAdvisorChainFactory.java:60)
at org.springframework.aop.framework.AdvisedSupport.getInterceptorsAndDynamicInterceptionAdvice(AdvisedSupport.java:465)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:190)
at $Proxy0.perform(Unknown Source)
这种问题一般是由execution表达式写法上的错误导致无法找到匹配的类型
分享到:
相关推荐
在实际开发中,Spring AOP广泛应用于事务管理。例如,我们可以定义一个切面来处理所有数据库操作的事务,这样无需在每个业务方法中显式调用开始和提交事务,只需在切面中配置事务规则即可。 `aop-jar`这个压缩包...
现在,我们回到主题——"springaop依赖的jar包"。在Spring 2.5.6版本中,使用Spring AOP通常需要以下核心jar包: - `spring-aop.jar`:这是Spring AOP的核心库,包含了AOP相关的类和接口。 - `spring-beans.jar`:...
2. **连接点(Joinpoint)**:在程序执行过程中的某个具体点,如方法调用、异常抛出等,这些点就是连接点。Spring AOP主要支持方法调用作为连接点。 3. **通知(Advice)**:在特定的连接点处执行的动作,如before...
在`springAop1`这个压缩包中,可能包含了一个简单的应用示例,展示了如何定义一个切面类,以及如何在该类中定义通知方法。例如,我们可能会看到一个名为`LoggingAspect`的类,其中包含了`@Before`注解的方法,用于在...
在Spring AOP中,主要有以下几个核心概念: 1. **切面(Aspect)**:切面是关注点的模块化,包含pointcut(切点)和advice(通知)两部分。例如,在上述代码中的`PersonProxy`类就是一个切面,它定义了`before()`和...
Spring AOP,全称Aspect-Oriented Programming(面向切面编程),是Spring框架的一个重要模块,它通过提供声明式的方式来实现面向切面编程,从而简化了应用程序的开发和维护。在Spring AOP中,我们无需深入到每个...
除了使用 AspectJ 进行 AOP 开发之外,Spring 还提供了另外两种方式来实现 AOP: 1. **基于注解的配置**:通过在切面类和方法上使用特定的注解来定义切面和通知。 2. **基于 XML 的配置**:通过 XML 文件来配置切面...
这里我们将深入探讨Spring AOP、相关jar文件以及它们在实际开发中的作用。 首先,我们来看一下提供的文件: 1. aopalliance.jar:这是一个小型库,定义了面向切面编程的基本接口。它被许多AOP框架使用,包括Spring...
面向切面编程(AOP,Aspect Oriented Programming)是Spring框架的一个核心特性,它提供了一种模块化和声明式的方式来处理程序中的交叉关注点,如日志、事务管理、性能监控等。AOP的主要思想是将这些横切关注点与...
本篇我们将深入探讨如何使用注解的方式来实现Spring AOP开发。 ### 一、注解基础 在Spring AOP中,主要使用以下几种注解: 1. `@Aspect`:定义一个切面类,切面是AOP的核心,包含通知(advisors)和切点...
**Spring AOP 简介** 面向切面编程(AOP),全称为 Aspect-Oriented ...在实际的企业级应用开发中,Spring AOP是不可或缺的工具,它使得开发者能够更加专注于业务逻辑,而无需关心那些横切关注点的实现细节。
Spring AOP 和 Spring IOC 是 Spring 框架的两个核心组件,它们对于任何基于 Java 的企业级应用开发都至关重要。Spring AOP(面向切面编程)允许开发者在不修改源代码的情况下,通过“切面”来插入新的行为或增强已...
Spring框架中的AOP模块使用了动态代理来实现AOP概念。Spring AOP允许开发者定义切面,并在这些切面中指定拦截的方法。Spring AOP支持不同的代理策略,包括JDK动态代理和CGLIB代理。如果被代理的类没有实现接口,...
在这个版本中,Spring AOP支持基于注解的切面定义,比如`@Aspect`、`@Before`、`@After`等,同时也支持基于XML配置的切面定义。这个jar包使得Spring应用程序能够方便地利用AOP特性,无需引入额外的编译工具或构建...
JavaEE Spring AOP(面向切面编程)是企业级应用开发中的重要技术,它允许开发者在不修改原有代码的情况下,通过“切面”来插入新的功能或者改变已有行为。Spring框架提供了对AOP的强大支持,使得我们可以方便地实现...
Spring AOP(Aspect Oriented Programming,面向切面编程)是Spring框架的重要组成部分,它允许我们通过分离关注点来简化应用程序的开发。在传统的面向对象编程中,业务逻辑与日志记录、事务管理、性能监控等横切...
在Spring框架中,AOP(面向切面编程)是一种强大的工具,它允许程序员将关注点分离,例如日志记录、事务管理、权限检查等,从核心业务逻辑中解耦出来。本篇主要探讨的是如何利用Spring AOP的注解来实现这些功能,...
**Spring AOP 使用实例** Spring AOP(Aspect Oriented Programming,面向切面编程)是Spring框架的一个重要组成部分,它提供了一种在不...在实际开发中,合理地运用Spring AOP,可以显著提高项目的质量和开发效率。
在`testaop`这个文件夹中,可能包含了一个简单的Spring配置文件(如`applicationContext.xml`),用于定义Bean和AOP配置。在配置文件中,我们需要声明一个切面类,该类包含了我们定义的通知。例如: ```xml <aop:...
在提供的压缩包文件"springAOP"中,可能包含了以下内容: - **切面类(Aspect Class)**:包含切点和通知的Java类,可能使用了`@Aspect`注解。 - **目标类(Target Class)**:被AOP代理的对象,通常包含业务逻辑。...