读书人

Trouble Shooting(一)AOP Configurati

发布时间: 2012-10-31 14:37:31 作者: rapoo

Trouble Shooting(1)AOP Configuration
Trouble Shooting(1)AOP Configuration
Today, once I configured AOP around to my spring project. It gives me this kind of error message.

Error Message:
java.lang.IllegalArgumentException: error at ::0 formal unbound in pointcut
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:254)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:925)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:835)

Solution:
Mostly, this is because of the parameters error. I put 3 parameters in my around method. But I only got 2 in the configuration file. That is the root cause. After I changed my configuration, my files are as follow:

<aop:aspect ref="advisor_catalogControllerImpl_search">
<aop:pointcut id="catalogControllerImpl_search" expression="execution(* com.sillycat.graphite.web.controller.impl.CatalogControllerImpl.search(..)) and args(request,response,..)"/>
<aop:before pointcut-ref="catalogControllerImpl_search" method="adviceBefore"/>
<aop:around pointcut-ref="catalogControllerImpl_search" method="adviceAround"/>
<aop:after-returning pointcut-ref="catalogControllerImpl_search" returning="modelAndView" method="adviceAfterReturning"/>
</aop:aspect>

<bean id="advisor_catalogControllerImpl_search" ").append(jp.toString());

if (logger.isDebugEnabled()) {
Object[] args = jp.getArgs();
if (args != null && args.length != 0) {
sb.append(" with ").append(args.length).append(" args.\n");
for (int i = 0; i < args.length; ++i)
sb.append("args[").append(i).append("]: ").append(args[i]).append("\n");
}

if (modelAndView != null)
sb.append("Returned ").append(modelAndView);

logger.debug(sb.toString());
} else
logger.info(sb.toString());
}
...snip...
}


references:
http://forum.springsource.org/showthread.php?62460-Formal-unbound-in-pointcut


读书人网 >软件架构设计

热点推荐