Search code examples
springaemspring-aopaem-6

Can we implement AOP with or without Spring in AEM 6.x?


We need to add some detailed level of logging in or AEM Models, Servlets and Services.

I wanted to know if we can do thing by implementing custom AOP in AEM or by using Spring AOP within AEM.

Does anyone have experience working on this?

PS: For those of you who don't know, AEM stands for Adobe Experience Manger a Java based CMS.


Solution

  • Maybe you just should have used your favourite web search engine.

    • AspectJ != Spring AOP
    • AspectJ is completely independent of any framework and can be used in any POJO Java SE application as well as in any container. I.e. you don't need Spring.
    • You have a choice between
      • compile-time weaving,
      • post-compile-time weaving (existing class files and JARs),
      • load-time weaving (Java agent applies instrumentation dynamically during class-loading).

    Just make your choice and maybe learn some AspectJ basics.