Basic concepts of AOP

Source: Internet
Author: User

1. What is AOP and how it is implemented

1.1. What is AOP

Aop:aspect oriented programming abbreviation, meaning: aspect-oriented programming, through the pre-compilation method and run-time dynamic agent to achieve a unified maintenance of program functions of a technology.

The main functions are: Logging, performance statistics, security control, transaction processing, exception handling and so on.

1.2. How AOP is implemented

1.2.1. Pre-compilation

--aspectj

1.2.2. Run-time dynamic agent (JDK Dynamic agent, cglib dynamic agent)

--SPRINGAOP, JBOSSAOP

1.3. The use of AOP in the spring framework

1.3.1. Statement of declarative Enterprise services, especially alternative services for EJBS

1.3.2. Allows users to develop their own aspects to accomplish the complementary use of OOP and AOP

1.4. Spring's AOP implementation

1.4.1. Pure Java Implementation, no special compilation process required, no control of class loader hierarchy

1.4.2. Currently only method execution connection points are supported (notifies the spring bean method execution)

1.4.3. Not to provide the most complete AOP implementation, but instead focus on providing an AOP implementation and integration between the spring IOC containers to help solve common problems in enterprise applications

1.4.4. Spring AOP does not compete with ASPECTJ to provide a comprehensive, holistic approach to AOP

1.5. Different spring AOP implementations with and without interfaces

1.5.1. Spring AOP defaults to using the standard javase dynamic proxy as an AOP proxy, which allows any interface (or set of interfaces) to be proxied

1.5.2. Cglib Proxy can also be used in Spring AOP (if a business object does not implement an interface)

2. Configure the slice aspect

2.1. schema-based AOP

Spring all of the post-section notifier must be placed within a <aop:config> (can be configured to contain multiple <aop:config> elements, each <aop:config> can contain pointcut, Advisor and aspect elements)

<aop:config>-style configuration heavily uses spring's automatic proxy mechanism

2.2. Aspect

2.2.1. <aop:config>

2.2.2. <aop:aspect>

1 <Aop:config>2     <Aop:aspectID= "Myaspect"ref= "Abean">3         ...4     </Aop:aspect>5 </Aop:config>6 7 <BeanID= "Abean"class="...">8     ...9 </Bean>

3. Configure Pointcut Pointcut

4.

2. Basic concepts of AOP

3. AOP in Spring

4. schema-based AOP

5. Spring AOP API

6. AspectJ

Basic concepts of AOP

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.