Dear all,
I'm a greenhorn in Spring, and reading the book of Spring in Action 2nd Edition now. I got following problem when following the examples in the book and attempting to mix injecting non-Spring beans with normal Spring AOP features. Related chapters in the book are 3.3 and 4.3.
Source codes & configurations are (some simple classes are omitted):
1. I defined Magician class as following. Please note in order o make injecting non-Spring beans work, the annotation is added:
2. The MagicBox implementation class is:
3. Audience class for the aspect is:
4. Configurations are:
5.
Test codes are:
And I run the codes with following VM argument:
Before applying the aop, both harry & lisa work perfectly well. However, after I added aop configurations, I got following output:
As you can see, harry still works but error happens at
I also noticed that if I move the section starting with
to the position before the definition of harry, then even harry cannot work.
Could anybody enlighten me on this. Thank you!