# AspectOptions

Options when Applying an Aspect.

- Source: [`core/lib/aspect.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/core/lib/aspect.ts#L40)
- Type last changed: v2.182.0 · 5 Mar 2025

## Example

```ts
class MutatingAspect implements IAspect {
  visit(node: IConstruct) {
    // Modifies a resource in some way
  }
}

class ValidationAspect implements IAspect {
  visit(node: IConstruct) {
    // Perform some readonly validation on the cosntruct tree
  }
}

const stack = new Stack();

Aspects.of(stack).add(new MutatingAspect(), { priority: AspectPriority.MUTATING } );  // Run first (mutating aspects)
Aspects.of(stack).add(new ValidationAspect(), { priority: AspectPriority.READONLY } );  // Run later (readonly aspects)
```

## Properties

- `priority`: number = AspectPriority.DEFAULT — The priority value to apply on an Aspect. Priority must be a non-negative integer.

  Aspects that have same priority value are not guaranteed to be
  executed in a consistent order.
