Aspect
Marks a class or object as an AspectK aspect.
The AspectK compiler plugin scans all classes annotated with @Aspect to discover advice declarations. Inside an aspect class, use Before to define advice methods that are injected at compile time before the body of any matching target function.
Aspects are typically declared as Kotlin objects to avoid instantiation overhead, but regular classes are also supported.
Example
@Aspect
object LoggingAspect {
@Before(target = [Authenticated::class])
fun log(joinPoint: JoinPoint) {
println("Calling: ${joinPoint.signature.methodName}")
}
}Content copied to clipboard