Error creating bean with name 'org.springframework.context.annotation.internalRequiredAnnotationProc
2011-08-28 09:45
465 查看
异常信息: xml 文件配置注解时报错
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.context.annotation.internalRequiredAnnotationProcessor': BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#0': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.aop.aspectj.AspectJPointcutAdvisor]:
Constructor threw exception; nested exception is java.lang.IllegalArgumentException: warning no match for this type name: cn.itcast.service.imple.AopServiceBean3 [Xlint:invalidAbsoluteTypeName]
原因:
applicatonContext.xml
<aop:config>
<aop:aspect id="asp" ref="myInterceptor1">
<!-- <aop:pointcut id="mycut" expression="execution(* cn.itcast.service.imple.AopServiceBean3..*(..))" />--> 正确的
<!-- <aop:pointcut id="mycut" expression="execution(* cn.itcast.service.imple.AopServiceBean3.*.*(..))" />-->正确的
<aop:pointcut id="mycut" expression="execution(* cn.itcast.service.imple.AopServiceBean3..*.*(..))" />正确的
<!--下面的配置有问题 AopServiceBean3.*(..) -->
<!-- <aop:pointcut id="mycut" expression="execution(* cn.itcast.service.imple.AopServiceBean3.*(..))" />-->错误的
<aop:before method="doAccessCheck" pointcut-ref="mycut"/>
</aop:aspect>
如用注解:
@Pointcut("execution (* cn.itcast.aop.service.imple..*.*(..))") //imple包下所有类的所有方法进行拦截
// @Pointcut("execution (* cn.itcast.aop.service.imple.AopServiceBean2.*(..))")只对AopServiceBean2类下方法进行拦截
有一个问题没有搞明白:为什么注解和配置一样会报错?
annotation:::::::<!-- <aop:pointcut id="mycut" expression="execution(* cn.itcast.service.imple.AopServiceBean3.*(..))" />-->错误的
xml::::::::::::::::::::// @Pointcut("execution (* cn.itcast.aop.service.imple.AopServiceBean2.*(..))")只对AopServiceBean2类下方法进行拦截 正确的
参考文章:
http://hi.baidu.com/gglzf4/blog/item/424bd5d761d23b2006088b1b.html
http://blog.csdn.net/sustbeckham/article/details/5819213
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.context.annotation.internalRequiredAnnotationProcessor': BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#0': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.aop.aspectj.AspectJPointcutAdvisor]:
Constructor threw exception; nested exception is java.lang.IllegalArgumentException: warning no match for this type name: cn.itcast.service.imple.AopServiceBean3 [Xlint:invalidAbsoluteTypeName]
原因:
applicatonContext.xml
<aop:config>
<aop:aspect id="asp" ref="myInterceptor1">
<!-- <aop:pointcut id="mycut" expression="execution(* cn.itcast.service.imple.AopServiceBean3..*(..))" />--> 正确的
<!-- <aop:pointcut id="mycut" expression="execution(* cn.itcast.service.imple.AopServiceBean3.*.*(..))" />-->正确的
<aop:pointcut id="mycut" expression="execution(* cn.itcast.service.imple.AopServiceBean3..*.*(..))" />正确的
<!--下面的配置有问题 AopServiceBean3.*(..) -->
<!-- <aop:pointcut id="mycut" expression="execution(* cn.itcast.service.imple.AopServiceBean3.*(..))" />-->错误的
<aop:before method="doAccessCheck" pointcut-ref="mycut"/>
</aop:aspect>
如用注解:
@Pointcut("execution (* cn.itcast.aop.service.imple..*.*(..))") //imple包下所有类的所有方法进行拦截
// @Pointcut("execution (* cn.itcast.aop.service.imple.AopServiceBean2.*(..))")只对AopServiceBean2类下方法进行拦截
有一个问题没有搞明白:为什么注解和配置一样会报错?
annotation:::::::<!-- <aop:pointcut id="mycut" expression="execution(* cn.itcast.service.imple.AopServiceBean3.*(..))" />-->错误的
xml::::::::::::::::::::// @Pointcut("execution (* cn.itcast.aop.service.imple.AopServiceBean2.*(..))")只对AopServiceBean2类下方法进行拦截 正确的
参考文章:
http://hi.baidu.com/gglzf4/blog/item/424bd5d761d23b2006088b1b.html
http://blog.csdn.net/sustbeckham/article/details/5819213
相关文章推荐
- 异常--Error creating bean with name 'org.springframework.context.annotation.internalAsyncAnnotationPro
- Error creating bean with name 'org.springframework.context.annotation.internalAsyncAnnotationProcess
- maven springmvc Error creating bean with name 'org.springframework.web.servlet.mvc.annotation
- Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingH
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxxx'
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 解决办法
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxx'
- org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name'se
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFacto
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'selectcommoninfo' defined in ServletCont
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFacto
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lanagerServi
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'UserDao' def
- Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'o
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name '***'
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name
- 关于org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFac
- 解决org.springframework.beans.factory.BeanCreationException: Error creating bean with name
- 错误:Error creating bean with name ‘org.springframework.validation.beanvalidation.LocalValidatorFactor