Spring Tutorial Home

  • Managing Database Transactions
  • Remoting in Spring
  • Working with the Web Layer

Spring Home

Java Resources

Community

Site

Defining AOP terminology


Lets begin with the basic terms and their meanings which are used in the AOP Languages.  There are two approaches in spring in which we write aspects in spring. First is schema based which are used in J2EE 1.4 environment and another one is aspects with annotation which are used  in all higher versions. The following are the terms and their meaning used in the AOP.





    • Join point: It is described as a point or statement during execution of a program For example code for handling of an exception in exception handling.



      • Advice: Advice is the code or action taken by an aspect at a particular join point. There are different types of advice like "around,""before" and "after" advice. Next section of the tutorial will discuss all in details.




      • Pointcut: A pointcut is an expression which matches the join point. For example if we want to execute the aspect before any method execution then point cut for that is the expression which satisfy that method call. All  Advices are associated with a pointcut expression and runs at any join point matched by the pointcut.



      • Aspect:-An aspect is obtained by merging  advice and pointcuts.


        • Introduction: Introductions are the additional methods or fields defined on behalf of a type. Spring AOP allows user to introduce new interfaces and implementation to any advised object.




        • Target object: The target object is an object which is being advised by one or more aspects. Also referred to as the advised object.Spring AOP is only implemented using runtime proxies, so target object will always be a proxied object.




        • AOP proxy: This is the proxy object which is created by AOP framework explicitly after implementing all the aspects contracts and advices. In the Spring Framework, an AOP proxy will be a JDK dynamic proxy or a CGLIB proxy.




        • Weaving: It is the process of linking aspects with other application types or objects to create an advised object. The weaving can take place at several points in the target object’s lifetime:




          1. Compile time—Aspects are woven in when the target class is compiled. This requires a special compiler. AspectJ’s weaving compiler weaves aspects this way.




          2. Classload time—Aspects are woven in when the target class is loaded into the JVM. This requires a special ClassLoader that enhances that target class’s bytecode before the class is introduced into the application. AspectJ 5’s load-time weaving (LTW) support weaves aspects in this way.




          3. Runtime—Aspects are woven in sometime during the execution of the application. Typically, an AOP container will dynamically generate a proxy object that will delegate to the target object while weaving in the aspects. This is how Spring AOP aspects are woven.











                    

Copyright © 2010 VisualBuilder. All rights reserved