首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

Trouble Shooting(一)AOP Configuration

2012-10-31 
Trouble Shooting(1)AOP ConfigurationTrouble Shooting(1)AOP ConfigurationToday, once I configured AO

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


热点排行