concept ordering in category aspectj

appears as: ordering, ordering
AspectJ in Action, Second Edition

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

In this chapter, we’ll take a closer look at the core aspect construct. We’ll begin by examining the aspect construct in a formal way and compare it to the class—the most similar concept in object-oriented programming. Next, we’ll examine the aspect association that provides a mechanism needed to write reusable aspects. We’ll follow that by considering the effects of multiple aspects in a system advising the same join point, and ways to control ordering. We’ll complete this chapter by examining a way aspects can override the standard access-specification rules.

It’s an error if a single declare precedence clause causes circular dependency in the ordering of aspect precedence. The following declaration produces a compile-time error because Auth* matches AuthenticationAspect, causing a circular dependency:

Listing 15.10. Aspect to control ordering of authentication and authorization
package ajia.security; import ... @Aspect @DeclarePrecedence("AbstractAuthenticationAspect+," + "AbstractAuthorizationAspect+") public class SecurityCoordinationAspect { }