Announcement Announcement Module
Collapse
No announcement yet.
Problem mixin compiled aspects and @Configurable beans Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem mixin compiled aspects and @Configurable beans

    Hi !

    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> ?

    Thanks !

  • #2
    I am not quite sure if I understand your question fully. In any case, using @Configurable with other aspects is perfectly fine. The bes t way to resolve this may be creating a smaller application and see its behavior. My best guess at this point is misconfigured project or some other configuration.

    -Ramnivas

    Comment

    Working...
    X