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