Aspect-oriented programming in Java

后端 未结 5 1949
遇见更好的自我
遇见更好的自我 2021-01-12 08:00

What is the best tool for Java for aspect-oriented programming?

The requirements for a tool are of course IDE support, expressiveness and proper documentation.

相关标签:
5条回答
  • 2021-01-12 08:22

    Regarding Spring AOP support. By default it's relevant only for Spring manageable objects and AFAIK it based on AspectJ.

    I didn't check it by myself yet, but it looks like it allows use AOP and for other objects (e.g. load time weaving under Tomcat). Details are here.

    0 讨论(0)
  • 2021-01-12 08:30

    If you're already using Spring, managed obejects already have AOP support. Whilst not quite as flexible as AspectJ, it doesn't require the precompilation step that AspectJ does.

    0 讨论(0)
  • 2021-01-12 08:40

    AOP with spring fallow this link http://rajkrrsingh.blogspot.com/2012/10/spring-aop-tutorial.html

    0 讨论(0)
  • 2021-01-12 08:44

    I would say AspectJ. The IDE part, as far as I know, is lacking, but documentation and expressiveness is among the best of the AOP frameworks I have seen.

    0 讨论(0)
  • 2021-01-12 08:47

    JBossAOP and AspectJ are two commonly used, mature frameworks for AOP. Another popular choice is Spring AOP, but it lacks some of the features of the other two.

    Both JBossAOP and AspectJ have similar features, one big difference being that AspectJ relies on extensions to the Java language, whereas JBoss AOP does not.

    If your AOP requirements are fairly simple, it's also worth considering a byte-code manipulation library, such as ASM. I've used ASM to implement simple 'around-advice' (ie, code that is injected before and after method invocations), and it proved to be a more lightweight alternative to JBossAOP. ASM is cleanly-designed and well-documented.

    0 讨论(0)
提交回复
热议问题