> For the complete documentation index, see [llms.txt](https://wirebox.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wirebox.ortusbooks.com/5/aspect-oriented-programming/aop-intro/create-your-aspect.md).

# Create Your Aspect

Now that we have activated the AOP engine, let's build a simple method logger aspect that will intercept before our method is called and after our method is called. So if you remember your AOP dictionary terms, we will create an aspect that does a before and after advice on the method. Phew! To do this we must implement a CFC that WireBox AOP gives you as a template: `wirebox.system.aop.MethodInterceptor`. This CFC interface looks like this:

```javascript
<cfinterface hint="Our AOP Method Interceptor Interface">

    <---  invokeMethod --->
    <cffunction name="invokeMethod" output="false" access="public" returntype="any" hint="Invoke an AOP method invocation">
        <cfargument name="invocation" required="true" hint="The method invocation object: wirebox.system.ioc.aop.MethodInvocation">
    </cffunction>

</cfinterface>
```

This means, that we must create a CFC that implements the `invokeMethod` method with our own custom code. It also receives 1 argument called `invocation` that maps to a CFC called `wirebox.system.aop.MethodInvocation` that you can learn from our cool [API](http://www.coldbox.org/api).

Our approach to AOP is simplicity, therefore this `invokeMethod` implements the most powerful advice called around advice, so you will always do an around advice, but it will be up to your custom code to decide what it does before (**beforeAdvice**), around (**aroundAdvice**) and after (**afterAdvice**) the method call.

The other advantage of WireBox AOP aspects is that once they are registered with WireBox they act just like normal DI objects in WireBox, therefore you can apply any type of dependency injection to them.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://wirebox.ortusbooks.com/5/aspect-oriented-programming/aop-intro/create-your-aspect.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
