源码分析:Spring - AOP, Cache 发表于 2024-05-09 | 分类于 ---Spring , ---源码 | 1234567891011AOP - ProxyFactory @EnableAspectJAutoProxy AspectJAutoProxyRegistrar AnnotationAwareAspectJAutoProxyCreator -> AbstractAutoProxyCreator.postProcessAfterInitialization -> wrapIfNecessary -> 找到 @Aspect Advisor=增强方法 -> 创建代理并返回 createProxyCache - @EnableCaching CachingConfigurationSelector -> ProxyCachingConfiguration BeanFactoryCacheOperationSourceAdvisor -> CacheInterceptor CacheInterceptor将@Cacheable @CacheEvict @CachePut转换为对应的CacheOperationContext CacheInterceptor在execute()方法中基于CacheOperationContext介入方法的执行流程,处理各种缓存逻辑