
Originally Posted by
Marten Deinum
Please use [ code][/code ] tags when posting code/xml/stacktraces that way it remains readable..
Next please use the forum search as this question has been answered before also this is answered by reading the reference guide.
In short the bean definitions (actually the Bean(Factory)PostProcessors) operate only on the application context they are defined in. So your aop:aspectj-autoproxy is useless for beans defined in the springshare-servlet.xml.
Hi Marten,
Sorry for the inconvenient. But I defined the tag "component-scan" in applicationContext.xml also as below:
Code:
<aop:aspectj-autoproxy/>
<context:component-scan base-package="com.chalet.springshare">
<context:include-filter type="annotation" expression="org.aspectj.lang.annotation.Aspect" />
</context:component-scan>
In my opinion, it means all the class who has the annotation "@Aspect" in the related packages will be defined and useful, right? Just like the MVC, if I defined the tags as below, all the class who has the annotation "@Controller,@Service" in the related packages will be defined and useful.
Code:
<context:component-scan base-package="com.chalet.springshare" ></context:component-scan>
<mvc:annotation-driven />
I am not sure, but am I right?