Spring Tutorial Home
- Introduction to Spring
- What is Spring?
- What are the main concepts for Spring?
- Why use Spring?
- Spring architecture
- Installing Spring
- Where is Spring in our applications?
- How to create a bean descriptor XML file?
- Spring and Struts
- Spring and Struts - Hello World example
- Spring data access overview
- Spring data access example using Hibernate
- Next Steps after Spring Introduction
- Wiring Beans
- Wiring Beans Introduction
- BeanFactory Interface
- ApplicationContext Interface
- Beans and its Lifecycle in Spring
- Instantiating the Beans in Spring
- Create/Destroy the Beans Globally
- InitializingBean and DisposableBean Interfaces
- Dependency Injecting with constructors
- Setter Injection In Spring
- Wiring Collections
- References to other beans (collaborators)
- Bean scopes in Spring
- Lazily-instantiated beans
- Autowiring in Spring
- Autowiring Spring Example
- Spring and AOP (Basics)
- Introduction To AOP
- Defining AOP Terminology
- Types Of Advice
- Example and Steps for Creating Advice-1
- Example and Steps for Creating Advice-2
- Example and Steps for Creating Advice-3
- Advice Parameters-1
- Advice Parameters-2
- Creating After Returning Advice
- Creating After Advice
- Creating After Throwing Advice-1
- Creating After Throwing Advice-2
- Around Advice Example-1
- Around Advice Example-2
- Annotation Support in Spring AOP-1
- Annotation Support in Spring AOP-2
- Database Connectivity in Spring
- Members (28736)
- Member Articles ( 41 )
- Discussion (283)
- Q & A ( 172 )
- - Ask Question
- - Questions
- - Unanswered Questions
- Source Code (1096)
- Articles (552)
- Blogs (133)
- Jobs (801)
- Components (85)
- Books (169)
- Websites (127)
- News (103)
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:
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.
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.
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.
- - Difference between BMT an
- - Replace getParameterValue
- - Interviewing Next week -
- - Sudoku solver
- - Setting tab order in swin