I am using a plain java application that gets bean and uses them as:
The code for the Performer Interface: package com.springinaction.springidol;
When I run the application, I get to see only tthe sys outs of the Instrumentalist class and the Saxophone class. This shows that the functionality of the aspect is not associated with the bean. Am I missing something?
From what I understand, any bean defined in the application context with the @AspectJ annotation will be detected by Spring. So unless the AudienceAspect is loaded, I don't think Spring will know about it. Please try the following :
1. Add the @AspectJ annotated bean in the context file
2. Use the ApplicationContext, so that your beans will be loaded by Spring
[ February 29, 2008: Message edited by: Christophe Verre ]
A BeanFactory instantiates beans only when needed, so the advice will not be instantiated unless you explicitly load it, or reference it in an other loaded bean. On the contrary, an ApplicationContext instantiates all beans, unless you explicitly tell Spring not to.