Discussions

News: Weaving process with aspectj and spring-aspects using Maven.

  1. In previous post link I talked about aspects, concretely ITD, and how can be used to design your classes with its own responsibilities while maintaining source code clear and concise. In that post I used aspectj and spring-aspects as aspect-oriented implementations. An important concept ofaspect programming is the process of weaven. An aspect weaver takes information from raw classes and aspects and creates new classes with the aspect code appropriately weaved into the classes.

    If you are using Eclipse with AJDT plugin, weaver is executed automatically, but if you are using any build tool like Maven, you should take care of configuring correctly so generated classes contains aspect code too.

    In this post I will explain how I have modified a pom file so compilation process also weaves aspect code into classes.

    First thing I always do when I generate a pom file is adding component version in properties section. In this case spring and aspectj:

     

    Read Post

    Threaded Messages (5)

  2. Typo?

    http://www.urbandictionary.com/define.php?term=Weaven

     

    When setting up aspectj compilation with maven first time I find it useful to decompile one or two .class files and make sure expected aspects are woven.

    Not doing so may lead to weird issues that are hard to troubleshoot, e.g. you believe component is transactional, while in fact it is not, because relevant aspect is not woven.

  3. Program, don't weave[ Go to top ]

    This is the over-engineered Spring/AOP way of programming that fortunately has gone out of fashion.

  4. Program, don't weave[ Go to top ]

    Well... I for one choose @Transactional over explicit startTransaction()/stopTransaction() or executeInTransaction(new AnonymousCallback() {...});

  5. Program, don't weave[ Go to top ]

    Annotations != AOP

  6. Program, don't weave[ Go to top ]

    true, annotations alone are not of much use.

    AOP gives a well-thought programming model and tooling that (among many other things) adds semantics to annotations, thus enabling easy to use declarative features. Like transaction management in spring framework.