Results 1 to 2 of 2

Thread: Problem mixin compiled aspects and @Configurable beans

  1. #1

    Default 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. #2
    Join Date
    Jun 2006
    Location
    SF Bay Area, California
    Posts
    524

    Default

    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
    Ramnivas Laddad (Follow me on Twitter)
    AspectJ in Action: Enterprise AOP with Spring Applications (2nd edition). Now available!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •