dimanche 15 mars 2015

AspectJ - Compile time Weaving With xml configuration

I am trying to create a java aspectj (using @Aspectj annotation) framework which will silently capture data and publish it to another system when it is integrated with Java service components ( JBOSS , Tomcat). For example, The framework will support capturing Request and response data of the service APIs and data loaded from Database by the service for the API call ( there are more kind of data will be captured other than example that i have provided) .



  1. Service component owner will provide a xml which will map the domain object methods to specific aspect method for capturing data. ( Service owner can decide certain DB data is not needed to be captured.)


  2. For the component services to use this capability, they will compile the service component with the jar that provide using aspectj-maven-plugin. ( I would like to go with compile time weaving rather than load time weaving as it may influence the runtime performance of the services ). What I am trying to achieve is that aspectj compilation should consider the xml and map the pointcut and advice according to xml configuration to the aspect class methods.


    With extensive browsing on this topic, i see that it is possible with spring xml configuration. For the spring xml configuration, every domain object ( for which advice code needs to be injected) has to be either a bean or annotated with @configurable. It would be impossible to modify all service domain objects to be annotated with @configurable. [Added Point ] Spring XML ( Spring AOP) will not work for me as it is Load time weaving. so this point is not valid.




so the question is that "Is it possible to enable compile time weaving of AspectJ(annotation) using xml configuration ( point cuts and advice map to aspect methods) ?"


Aucun commentaire:

Enregistrer un commentaire