Error creating bean with name 'org. springframework. Context. annotation. internalrequiredannotati

Source: Internet
Author: User

Error message: an error is reported when the XML file is configured with annotations.

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: cocould 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]

 

Cause:

Applicatoncontext. xml

<AOP: config>
<AOP: aspect id = "asp" ref = "myinterceptor1">
<! -- <AOP: pointcut id = "mycut" expression = "execution (* CN. itcast. Service. imple. aopservicebean3. * (...)"/> --> correct

<! -- <AOP: pointcut id = "mycut" expression = "execution (* CN. itcast. Service. imple. aopservicebean3. *. * (...)"/> --> correct
<AOP: pointcut id = "mycut" expression = "execution (* CN. itcast. Service. imple. aopservicebean3. *. * (...)"/> correct
<! -- The following configuration has a problem. aopservicebean3. * (...) -->
<! -- <AOP: pointcut id = "mycut" expression = "execution (* CN. itcast. Service. imple. aopservicebean3. * (..)"/> --> incorrect
<AOP: Before method = "doaccesscheck" pointcut-ref = "mycut"/>
</AOP: aspect>

 

For example:

@ Pointcut ("execution (* CN. itcast. AOP. Service. imple... *. * (..)") // intercept all methods of all classes in the imple package
// @ Pointcut ("execution (* CN. itcast. AOP. Service. imple. aopservicebean2. * (..)") only blocks methods in the aopservicebean2 class

 

I have a question: why is an error reported when the annotation is the same as the configuration?

Annotation ::::::::::<! -- <AOP: pointcut id = "mycut" expression = "execution (* CN. itcast. Service. imple. aopservicebean3. * (..)"/> --> incorrect

XML: // @ pointcut ("execution (* CN. itcast. AOP. service. imple. aopservicebean2 .*(..)) ") only the methods in aopservicebean2 are intercepted correctly.

References:

Http://hi.baidu.com/gglzf4/blog/item/424bd5d761d23b2006088b1b.html

Http://blog.csdn.net/sustbeckham/article/details/5819213

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.