8.4.1: Prepare aspectj for Implementing AOP

Source: Internet
Author: User

AOPIt is specially used to deal with cross-focus issues distributed in various modules (different methods) in the system. In Java EE applications, AOP is often used to deal with system-level services with cross-cutting nature, such as transaction management, security check, cache, Object pool management, etc. AOP has become a very common solution.

Aspectj:

Aspectj is a Java-based AOP framework that provides powerful AOP functions. Many other AOP frameworks use or adopt some of its ideas. Because spring's AOP and aspectj are well integrated, understanding aspectj is the basis for learning Spring AOP.

Aspectj is an AOP Implementation of the Java language. It consists of two parts:Part 1Defines how to express and define the syntax specifications in AOP programming. With this set of syntax specifications, we can easily use AOP to solve the cross-focus issues in Java;Part 2Is a tool, including compilers, debugging tools, etc.

Aspectj is one of the earliest and most powerful AOP implementations. It has a good implementation of the entire AOP mechanism. Many other languages also use the AOP implementation to learn from or adopt many designs in aspectj. In the Java field, many Syntax structures in aspectj have basically become the standards in the AOP field.

Since spring2.0, Spring AOP has introduced support for aspectj and allows direct use of aspectj for AOP programming. Spring's aop apis also strive to be consistent with aspectj. Therefore, learning Spring AOP must begin with aspectj, because it is the most popular AOP solution in the Java field. Even without the Spring framework, we can even use aspectj for AOP programming directly.

Download and install aspectj and configure the environment variables:

LoginClick Open LinkDownload a stable version of aspectj. Select aspectj1.6.10. After the download is complete, get a aspectj-1.6.10.jar file. Put it in the aspectj folder under the Lib folder of drive D. Start the command line window:

Here is my installation directory:

After installation, rememberConfigure environment variables:

SetE: \ Java \ AOP \ aspectj1.6.10 \ binAdd it to the PATH environment variable. Note that it is separated from other environment variables previously configured in the path by a semicolon. Because I have not configured the classpath environment variable before, create a new classpath environment variable.E: \ Java \ AOP \ aspectj1.6.10 \ Lib \ aspectjrt. JarNote that this is not enough. Before e, you must add an English dot and Semicolon. The first is the dot and the last is the full path of the aspectjrt. jar file.


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.