1

I was going through spring documentation, and this is what it says about join points

" Join point: a point during the execution of a program, such as the execution of a method or the handling of an exception. In Spring AOP, a join point always represents a method execution."

and also this is what the document says regarding "before advice"..

"Before advice: Advice that executes before a join point, but which does not have the ability to prevent execution flow proceeding to the join point (unless it throws an exception)."

When they say, the before advice executes before a join point, where exactly is that point located for a given method.Lets say we have the following method, is it correct to assume that it will be located at the place where we have the greater than> symbol inside the method ?

public void Calculate()
{
     >
     // some logic
}

2 Answers2

1

For Spring AOP (a proxy-based framework) it is more like this:

class MyClass implements MyInterface {
    public void doSomething() {}
}
// Dynamic proxy created during runtime
class ProxyXY extends MyClass implements MyInterface {
    public void before_doSomething() {
        // Do whatever the AOP advice says and then...
        doSomething();
    }
}

This is really just schematic and simplified, but I guess you get the idea. In AspectJ it is quite different because there are no proxies involved and bytecode is generated directly into the target class.

kriegaex
  • 63,017
  • 15
  • 111
  • 202
  • Thank you.Correct me if I am wrong.What you are saying is when a proxy class is being created. the "before advice" is created just above the "whatever method we choose" in that particular proxy class. – Digital Dave Oct 01 '16 at 07:45
  • What do you mean by "above"? Please try not to think of aspects from a source code perspective. – kriegaex Oct 08 '16 at 13:46
-1

A Join Point basically is the point of program in application which joins the business logic of the application with the centralized AOP concerns. Spring only supports method execution as a Join point i.e. before or after execution of a method(action) in the business logic ,we can join to a concern as required. Go through this article for getting a gist on AOP in Spring.

http://codemodeweb.blogspot.in/2018/03/spring-aop-and-aspectj-framework.html

arif abbas
  • 341
  • 2
  • 6