# 5.3AOP代理

SpringAOP默认为对AOP代理使用标准的JDK动态代理。这样就可以代理任何接口（或一组接口）。

SpringAOP也可以使用CGLIB代理。如果要代理类而不是接口，则必须使用CGLIB。默认情况下，如果业务对象不实现接口，则使用cglib。由于编程到接口而不是类是很好的实践，业务类通常实现一个或多个业务接口。在某些情况下（可能很少），需要通知一个接口上没有声明的方法，或者需要将代理对象作为具体类型传递给方法，则可以强制使用cglib。

重要的是要了解SpringAOP是基于代理的。请参阅了解AOP代理以彻底检查此实现细节的实际含义。


---

# Agent Instructions: 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:

```
GET https://docs.flydean.com/spring-framework-documentation5/core-technologies/5spring-aop/5.3aop-proxies.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
