Cannot define both 'pointcut' and 'pointcut-ref' on tag.

 

错误信息:

2013-09-01 14:00:56  Class [com.ibm.websphere.management.AdminServiceFactory] or one of its dependencies is not present: java.lang.ClassNotFoundException: com.ibm.websphere.management.AdminServiceFactory
iException in thread "main" org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Cannot define both 'pointcut' and 'pointcut-ref' on <advisor> tag.
Offending resource: class path resource [applicationContext.xml]
Aspect: id='asp'
 -> Advice (before)
 at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
 at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
 at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:80)
 at org.springframework.aop.config.ConfigBeanDefinitionParser.parsePointcutProperty(ConfigBeanDefinitionParser.java:502)
 at org.springframework.aop.config.ConfigBeanDefinitionParser.createAdviceDefinition(ConfigBeanDefinitionParser.java:420)
 at org.springframework.aop.config.ConfigBeanDefinitionParser.parseAdvice(ConfigBeanDefinitionParser.java:363)
 at org.springframework.aop.config.ConfigBeanDefinitionParser.parseAspect(ConfigBeanDefinitionParser.java:258)
 at org.springframework.aop.config.ConfigBeanDefinitionParser.parse(ConfigBeanDefinitionParser.java:148)
 at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:69)
 at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1253

 

解决方案:

错误原因是因为配置AOP时,通知里面引入了切入点,如果在配置一个切入点就会发生以上错误.

比如: 

<aop:beforepointcut-ref="mycut"method="doAccessCheck" pointcut="execution(* com.java.spring..*.*(..))"/>

 

 

正确的应该是:

<aop:beforepointcut-ref="mycut"method="doAccessCheck" />

或者

<aop:before pointcut="execution(* com.java.spring..*.*(..))“ method="doAccessCheck" />

 

你可能感兴趣的:(poi)