title: How does AspectJ work?
body: <p>I am trying to understand how Aspect works. I come from a C/C++ background where magic never happens.</p>
  
  <p>I understand that you can annotate some functions with <code>@Aspect</code> then write down the Aspect implementation and so on. But, how (and at what time) does the new code get generated?</p>
  
  <p>Assuming I have no editor. I compile java classes using <code>javacc</code> command
  that will generate <code>.class</code> files. Now, assume that the java files are annotated using Aspect. Shouldn't I then compile the <code>.class</code> files again with Aspect somehow to generate another set of <code>.class</code> files?</p>
  
  <p>If my understanding is correct, how is this dual compilation step done in maven? or spring? I found many tutorial that will tell you what to add here and there to get things working but no tutorial explains how these things are actually working.</p>