I have a few aspectsj classes, using @Aspect annotation (no .aj files, all .java).
I would like to inject dependencies into them, so in my XML appctx, I'm declaring these aspect classes with a factory-method "aspectOf".
I also have POJOS using the spring @Configurable annotation, so in my XML appctx, I added a single <aop:spring-configured/> line.
I am not using load time weaving (no aop.xml), but compile time weaving.
Now, here is my problem :
- if during a test, I start a spring application context under eclipse, sometimes, the startup fails with a "no factory method defined for aspectOf". If I wait a second or two, letting eclipse AJDT plugin weave my compiled classes, and I startup again, the error disappears, and my aspects have their dependencies injected. @Configurable beans do not receive injections, because spring-aspects.jar is not in AJDT classpath, so the bean configurer aspect is not used.
- if I start the same appCtx under tomcat, I always receive the "no factory method" error during context startup. But @Configurable beans receive injections (and I don't understand how)
- the only working scenario is when I compile classes with the <iajc> ant task, including spring-aspects.jar on its classpath : when the context starts under tomcat, my aspects receive injections because aspectOf works, and so do @Configurable beans.
Question is rather simple : can I mix aspectOf beans with @Configurable ones, without using the <iajc> aspectj compiler ? Or am I required to use load time weaving if I want to do this without using <iajc> ?