源码分析:Spring - AOP, Cache

1
2
3
4
5
6
7
8
9
10
11
AOP - ProxyFactory   @EnableAspectJAutoProxy   AspectJAutoProxyRegistrar
AnnotationAwareAspectJAutoProxyCreator
-> AbstractAutoProxyCreator.postProcessAfterInitialization
-> wrapIfNecessary
-> 找到 @Aspect Advisor=增强方法
-> 创建代理并返回 createProxy
Cache - @EnableCaching CachingConfigurationSelector
-> ProxyCachingConfiguration BeanFactoryCacheOperationSourceAdvisor
-> CacheInterceptor
CacheInterceptor将@Cacheable @CacheEvict @CachePut转换为对应的CacheOperationContext
CacheInterceptor在execute()方法中基于CacheOperationContext介入方法的执行流程,处理各种缓存逻辑