We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
地址:https://github.com/YunaiV/ruoyi-vue-pro/blob/v2.0.1/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalResponseBodyHandler.java 今天再看源码的时候发现这段注释,我印象中统一异常处理器虽然叫advice,但是好像并不是aop,只是相当于在外层加了一些try-catch,不知道有没有记错
The text was updated successfully, but these errors were encountered:
肯定是aop
Sorry, something went wrong.
spring boot的aop现在都是用代理实现的,ControllerAdvice连代理都不是,为什么是aop呢
ai是个好东西:
在Spring框架中,AOP(面向切面编程)的实现通常是通过代理来完成的。但是,AOP的概念并不仅限于代理。AOP是一种编程范式,其核心思想是将那些与业务无关,但在多个地方被重复使用的代码(例如日志、事务管理、安全检查等),抽取出来,形成一个独立的模块,这个模块就是切面(Aspect)。
在Spring MVC中,@ControllerAdvice注解可以被视为一种AOP的应用,虽然它并不是通过代理来实现的。@ControllerAdvice注解可以定义全局的异常处理器,这个处理器可以捕获所有控制器抛出的异常。这就是一种横切关注点(Cross-cutting Concerns)的体现,也就是AOP的核心思想。
@ControllerAdvice
所以,即使@ControllerAdvice并不是通过代理来实现的,但是它的功能(全局异常处理)符合AOP的概念,因此我们可以将其视为AOP的一种应用。
https://doc.iocoder.cn/exception/
YunaiV
No branches or pull requests
地址:https://github.com/YunaiV/ruoyi-vue-pro/blob/v2.0.1/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalResponseBodyHandler.java
今天再看源码的时候发现这段注释,我印象中统一异常处理器虽然叫advice,但是好像并不是aop,只是相当于在外层加了一些try-catch,不知道有没有记错
The text was updated successfully, but these errors were encountered: