How is Aspect Oriented Programming implemented in Spring?
Anoniem
I guessed "Perhaps a preprocessor" (I had no idea.) Again, after the interview I did some Googling and found: "AspectJ, the mostly widely used aspect engine for Java, avoids the harder problem of parsing/Life After Parsing by relying on the class files built by the compiler, which has already solved those problems. An AspectJ user writes “aspects” (roughly as the above “insert” aspect), AspectJ shuffles through the byte codes looking for function calls that match the predicate, and it patches the byte code. [More complex AspectJ aspects require following the control flow graph, which is pretty easily determined from the byte code]. The effect is the same: the program gets changed."