0%
Spring使用-Aspect-扩展知识
发表于:
Spring源码-Aspect-内置Advisor与Interceptor
发表于:
ExposeInvocationInterceptor
将 MethodInvocation 存储到 ThreadLocal 变量中。
|
|
END
Spring源码-Aspect-扩展知识
发表于:
Spring源码-Aspect-执行顺序
发表于:
Spring源码-Aspect-场景与接口
发表于:
Spring AOP Advice 场景
- 环绕通知(Interception Around Advice)
- public interface MethodInterceptor extends Interceptor
- 前置通知(Before Advice)
- public interface MethodBeforeAdvice extends BeforeAdvice
- 后置通知(After Advice)
- public interface AfterAdvice extends Advice
- 返回通知(After Returning Advice)
- public interface AfterReturningAdvice extends AfterAdvice
- 异常通知(Throws Advice)
- public interface ThrowsAdvice extends AfterAdvice
- 引入通知(Introduction Advice)
- public class DelegatingIntroductionInterceptor extends IntroductionInfoSupport implements IntroductionInterceptor
- public interface IntroductionInterceptor extends MethodInterceptor, DynamicIntroductionAdvice
- 引入通知的主要作用是可以让生成的代理类实现额外的接口。
Spring AOP 使用关键接口
- PointcutAdvisor = Advice + Pointcut
- Advice: AspectJAroundAdvice/AspectJMethodBeforeAdvice/AspectJAfterAdvice/AspectJAfterReturningAdvice/AspectJAfterThrowingAdvice
- Pointcut: AspectJExpressionPointcut
- PointcutAdvisor: InstantiationModelAwarePointcutAdvisorImpl instanceof PointcutAdvisor
- Advisor refers to PointcutAdvisor
Advisor
|
|
Advice
|
|
|
|
Pointcut
|
|
END
SpringBoot文件下载
发表于:
背景
HTTP头部默认只支持ISO-8859-1字符集,直接使用中文会导致乱码或解析错误。
文件下载响应体方案
|
|
描述
Spring源码-Aspect-Bean解析流程
发表于:
自动配置
方式一:注解启用
注解 EnableAspectJAutoProxy
启用 Spring Aspect 切面。
|
|
注解 EnableAspectJAutoProxy
底层实现是注册 AnnotationAwareAspectJAutoProxyCreator.class BeanDefinition 到 Spring 容器中。