Aspect Declarations
Prev | Chapter 9. An Annotation Based Development Style | Next

## Aspect Declarations

Aspect declarations are supported by the `org.aspectj.lang.annotation.Aspect` annotation. The declaration:

         @Aspect
         public class Foo {}

Is equivalent to:

         public aspect Foo {}

And since issingleton() is the default aspect instantiation model it is equivalent to:

          @Aspect("issingleton()")
          public class Foo {}

To specify an aspect an aspect instantiation model (the default is singleton), provide the perclause as the `@Aspect` value. For example:

         @Aspect("perthis(execution(* abc..*(..)))")
         public class Foo {}

is equivalent to...

         public aspect Foo perthis(execution(* abc..*(..))) {}

### Limitations

Privileged aspects are not supported by the annotation style.

Prev | Home | Next
Chapter 9. An Annotation Based Development Style | Up | Pointcuts and Advice