The key component of the spring framework is the aspect-oriented programming (AOP) framework. Aspect-oriented programming not only breaks down the logic of the program into different parts called the so-called worry. The functionality of an application that spans multiple points is known as crosscutting concerns and these crosscutting concerns are distinguished from the business logic concepts of the applic
I. PrefaceIn previous projects, very little attention to the specific implementation and theory of spring aop, just a simple understanding of what is AOP specific how to use, see a blog post is also good, reproduced to learn, Bowen Address: http://www.cnblogs.com/xrq730/p /4919025.htmlAopAOP (Aspect oriented programming), which is aspect-oriented programming, can
I. PrefaceIn previous projects, very little attention to the specific implementation and theory of spring AOP, just a simple understanding of what is AOP specific how to use, see a blog post is also good, reproduced to learn, Bowen address: http://www.cnblogs.com/xrq730/p /4919025.htmlAopAOP (Aspect oriented programming), which is aspect-oriented programming, can
implementation of Aop;spring AOP is an AOP implementation scheme, It supports AOP by weaving aspect into the target code in the runtime based on a dynamic proxy, where dynamic proxies are available in two ways (JDK dynamic agent and Cglib dynamic agent), which is not said h
AopThrowsInterceptor
AOP concepts Aspect
In this example, the methods withAop () and withoutAop () all have some code, which can be seen as the aspect in AOP and can be understood as a module.
Notification Advisor
In this example, the three interce
The main points of this essay are as follows:
What is AOP
AOP Terminology Interpretation
XML implementations of AOP in spring
First, what is AOPAOP (Aspect oriented programming), which is tangent-oriented programming. So what is plane-oriented programming? What is the plane?For
'=========== into around surround Method! =========== before calling the method: Execute! ========== call Pointcut: Cat says: You dare to delete me! =========== output: cat; delete; [email protected]; Cat: Aim ~ Call Method End: Then execute! ========== enters after advice=========== the Pointcut method executes the Cat in class test. The Delete method on the Aspectbusiness object has been deleted leaving only:nullSo the example of
2.0 uses ponintcut expression, very AOP configuration of everything aspect.
At 2.1.0, an object that has already been AOP cannot be AOP again.
In the Spring 1.0 document, Rod says, for example,
3. Bookmanager can define themselves directly, not as anonymous internal tar
AOP proxy in springThe IOC container of spring is responsible for generation and management, and its dependency is also managed by the IOC container. Therefore, the AOP proxy can directly use other bean instances in the container as the target. This relationship can be provided by the dependency injection of the IOC container. By default,
AOP is a complement to OOP, mainly to solve the 2 problems of code confusion code dispersionBenefits of AOP:1, each transaction logic in one location, code is not scattered, easy to maintain and upgrade2, the Business module is more concise, contains only the core business codeThe main programming objects of AOP are facets (validation parameters, pre-log, add (),
Let's talk about why we need AOP.One of the simplest examples is logging, and if you want to record the execution of some methods, the stupidest way to do this is to modify every method that needs to be recorded. But this, really stupid ...A good method should be to get the method through reflection, then to match, if you need to log, then call the log method.This is the Weavingof AOP, commonly known as weaving, weaving, is to weave the functionality
1. Write an example of transaction management using AOP today, and the following are the first things you need to know about transactions(1) Characteristics of the transaction
Atomicity (atomicity): A transaction is an atomic operation that consists of a series of actions. The atomicity of a transaction ensures that the action is either complete or completely ineffective.
Consistency (consisten
1.Aspect Crosscutting a concern in multiple classes, in spring AOP, the aspect implementation is a rule class or a @aspect-labeled rule. For example: Transaction management2.Join Point A point in the execution of a program, such as executing a method or handling an exception, in spring
1, the AOP concept of aspect-oriented programming is actually when dealing with a series of business logic, this series of actions as a set of actions. For example, to connect to a database: Load the driver-----get the class--------get the Connection object-------access the database------query---------operation results for the above series of actions we see the dashed line as a slice. Then we add some logic
Introduced
As we all know, AOP (facet-oriented programming) is one of the features of the spring framework. AOP provides extremely high scalability by setting crosscutting concerns (cross cutting concerns). So how does AOP work in spring? When you can only use core Java, bu
The last blog. Spring (ii) in the IOC, I briefly introduced the IOC in the core content of the spring framework, and then we went on to another core AOP (Aspect oriented programming), namely, tangent-oriented programming.
1. Oop ReviewBefore introducing AOP, let's review the OOP (Object oriented programming) that ev
The Last post is simple and easy. Spring (ii) in the IOC detail, I gave you a brief introduction to the IOC in the core of the spring framework, and then we go on to another core AOP (Aspect oriented programming), the aspect-oriented programming.
1. Oop ReviewBefore introducing AOP, let's review the familiar OOP (Ob
crosscutting concern information , each Focus Point reflected as a notification method. 2.3 Notice (Advice)The specific work to be done by the facets2.4 goal (target )The object being notified2.5 Agent (proxy )after the notification is applied to the target object Proxy Object2.6 Connection point (joinpoint)The specific embodiment of crosscutting concerns in program code that corresponds to a specific location that the program executes. For example:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.