问题描述
ng3.0+struts2使用注解AOP报错。9月13日#成都#源创会,Swift、Docker、云计算、大数据!org.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'org.springframework.transaction.config.internalTransactionAdvisor':Cannotresolvereferencetobean'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0'whilesettingbeanproperty'transactionAttributeSource';nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0':Initializationofbeanfailed;nestedexceptionisjava.lang.IllegalArgumentException:errorat::0formalunboundinpointcut网上查过有的是说加入注解的方法带有参数,但是pointcut那里没注明arg导致,但是我拦截的是controller的方法。。不带参数而且没返回的。。===================================下面给出所有相关配置注解类@Target({ElementType.METHOD})@Retention(RetentionPolicy.RUNTIME)@Documented@Inheritedpublic@interfaceAop{Stringpattern()default"";}
切面类@Aspect@Component("aspect")publicclassAspect{@Around("@annotation(com.xx.annotation.Aop)")publicObjectexecute(ProceedingJoinPointpjp,Aopeaop){ObjectretVal=null;try{retVal=pjp.proceed();}catch(Throwablee){e.printStackTrace();}returnretVal;}}
app.xml配置:(已经引入http://www.springframework.org/schema/aop/spring-aop-3.0.xsd)<aop:aspectj-autoproxy/>controllerpublicclassAControllerextendsBaseController{@Aop(<spanstyle="font-size:9pt;line-height:1.5;">pattern</span><spanstyle="font-size:9pt;line-height:1.5;"></span><spanstyle="font-size:9pt;line-height:1.5;">=EtagTable.t_newsinfo)</span>publicvoidgetComment(){}}
相关的配置都已经贴出来了。。。在线求解答。。另外。好像搜索到有的文章介绍。。这种方法跟<tx:annotation-driventransaction-manager="transactionManager"/>会有冲突??是不是真的?