spring3.0+struts2使用注解AOP报错。

黄开源中国 发布于 2014/08/28 14:45
阅读 811
收藏 0
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.config.internalTransactionAdvisor': Cannot resolve reference to bean 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0' while setting bean property 'transactionAttributeSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: error at ::0 formal unbound in pointcut 

网上查过有的是说加入注解的方法带有参数,但是pointcut那里没注明arg导致,但是我拦截的是controller的方法。。不带参数而且没返回的。。

===================================下面给出所有相关配置

注解类

@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
public @interface Aop {
	String pattern() default "";


切面类

@Aspect
@Component("aspect")
public class Aspect {
@Around("@annotation(com.xx.annotation.Aop)")
public Object execute(ProceedingJoinPoint pjp, Aope aop) {
Object retVal = null;
try {	
	retVal = pjp.proceed();
} catch (Throwable e) {							e.printStackTrace();
}
return retVal;
}
}

app.xml配置:(已经引入http://www.springframework.org/schema/aop/spring-aop-3.0.xsd)


<aop:aspectj-autoproxy/>



controller



public class AController extends BaseController{
   @Aop(pattern=EtagTable.t_newsinfo) public void getComment(){
   }
}

相关的配置都已经贴出来了。。。在线求解答。。





加载中
返回顶部
顶部