concept section in category aspectj

appears as: section, section, sections, sections
AspectJ in Action, Second Edition

This is an excerpt from Manning's book AspectJ in Action, Second Edition.

  • A construct for selecting join points— Implementing a crosscutting concern requires selecting a specific set of join points. For example, the tracing aspect discussed earlier needs to select only the public methods in the system. The pointcut construct selects any join point that satisfies the criteria. This is similar to an SQL query selecting rows in database (we’ll compare AOP with databases in section 1.5.2). A pointcut may use another pointcut to form a complex selection. Pointcuts also collect context at the selected points. For example, a pointcut may collect method arguments as context. The concept of join points and the pointcut construct together form an AOP system’s join point model. We’ll study AspectJ’s join point model in chapter 3.
  • In the configuration, you declare a bean corresponding to the InventoryAuditing type. To instruct Spring to use an advice declared in such a bean, you use the <aop:aspectj-autoproxy/> element (we’ll examine it in detail in section 9.2.4). Now, when you compile the classes using the javac compiler and execute the program, you get the following output:

  • Prepare the aspects. This is logically the same step as in section 8.4. As you did there, you use the aspect from chapter 7, listing 7.10 and the concrete subaspect defined using the XML syntax from listing 8.2. First, copy ajia/monitoring/Monitoring.java to jpetstore’s source directory and aop.xml to the META-INF directory. The directory structure looks like this:
    org.springframework.samples.jpetstore/
    src/
    main/
    java/
    ajia/
    monitoring/
    Monitoring.java
    resources/
    META-INF/
    aop.xml
    webapp/
    WEB-INF/
    web.xml
    weaverContext.xml
    META-INF/
    context.xml