Framework
Java · 94 篇笔记
- 2.7 介绍historical
Spring MVC 以 DispatcherServlet 为入口,配合 HandlerMapping、HandlerAdapter 和 ViewResolver 处理请求与视图。
- 2.14 源码分析historical
本文通过控制器断点查看请求调用栈,再沿 HttpServlet、FrameworkServlet 和 DispatcherServlet 追踪 Spring MVC 的处理流程。
- 2.28 ApplicationListenerhistorical
ApplicationListener 通过观察者模式处理事件,让发布者与多个监听者解耦。笔记以下工单后分别发邮件、写日志等场景说明使用。
- 2.32 Autowired原理historical
Spring 在注册后置处理器和实例化 Bean 等阶段处理依赖注入。笔记沿 AutowiredAnnotationBeanPostProcessor 追踪 @Autowired 的实现。
- 2.33 Spring事务源码分析historical
@EnableTransactionManagement 向容器导入事务管理组件。笔记从这一注解开始,追踪 Spring 事务相关对象的注册与执行。
- 2.52 BeanFactoryhistorical
BeanFactory 负责实例化、配置和管理 Bean,ApplicationContext 在此基础上提供更多能力。笔记整理容器接口之间的关系。
- 2.54 循环依赖historical
假设有两个Bean,Bean1和Bean2,如果Bean1依赖Bean2,Bean2依赖Bean1。 那么Spring创建Bean1的时候需要先创建Bean2,创建Bean2又需要先创建Bean1,这就叫做循环依赖。
- 2.55 Spring中如何让A和B两个bean按顺序加载historical
本文通过 Controller 与 Service 的示例,观察 Spring 中两个 Bean 的加载关系,以及如何控制它们的初始化顺序。
- 2.56 1.创建NioEventLoopGrouphistorical
NioEventLoopGroup 管理多个 NioEventLoop,可以接收 Runnable 任务。笔记从构造过程开始,追踪线程组如何创建。
- 2.57 2.Bootstrap的创建historical
创建 ServerBootstrap 后,还需要设置 Channel、Handler 和相关选项。笔记重点追踪 Channel 类型如何配置。
- 2.60 pipeline的初始化historical
每个 Netty Channel 都有自己的 Pipeline,在 AbstractChannel 构造时创建。笔记继续查看 Pipeline 的初始化方式。
- 2.62 1.创建spring容器historical
创建 Spring 容器会触发 refresh 流程。笔记从 ApplicationContext 的创建开始,追踪容器初始化与 Bean 获取过程。
- 2.65 2.创建NioSocketChannelhistorical
Netty 接收 Java NIO 的客户端连接后,把它包装为 NioSocketChannel。笔记追踪这个对象及父类的构造过程。
- 2.66 添加删除ChannelHandlerhistorical
本文从 DefaultChannelPipeline 的 addLast 等方法开始,追踪 ChannelHandler 的添加、检查和删除过程。
- 2.68 2.调用BeanFactoryPostProcessor的postProcess方法historical
Spring 容器刷新时会调用 BeanFactoryPostProcessor。笔记从 invokeBeanFactoryPostProcessors 开始,追踪这些处理器的执行过程。
- 2.69 自动配置原理historical
@SpringBootApplication 关联 @EnableAutoConfiguration 等注解。笔记从这些入口追踪 Spring Boot 自动配置如何生效。
- 2.73 3.注册BeanPostProcessorhistorical
Spring 通过 registerBeanPostProcessors 把 Bean 后置处理器注册到容器中。笔记沿相关委托方法追踪注册过程。
- 2.74 4.向selector注册读事件historical
Channel 注册完成后,需要向 Selector 注册读事件。笔记沿 AbstractChannel 的 register 操作追踪这一过程。
- 2.76 4.实例化所有非懒加载的单实例beanhistorical
FinishBeanFactoryInitialization 阶段会实例化非懒加载的单例 Bean。笔记重点追踪 preInstantiateSingletons 的执行。
- 2.83 1.给容器中注入AspectJAnnotationAutoProxyCreator组件historical
开启 @EnableAspectJAutoProxy 后,Spring 会导入 AOP 相关组件。笔记从注解源码开始追踪自动代理创建器的注册。
- 2.84 2.1AnnotationAwareAspectJAutoProxyCreator_Bean实例是如何创建的historical
AnnotationAwareAspectJAutoProxyCreator 既是 Bean 后置处理器,也实现 BeanFactoryAware。笔记通过断点查看它的实例化与初始化。
- 2.86 2.初始化channelhistorical
Channel 初始化时会向 Pipeline 添加 ChannelInitializer,再把 ServerBootstrap 中配置的 Handler 接入处理链。
- 2.90 2.2AnnotationAwareAspectJAutoProxyCreator是在什么时候起作用的historical
本文从 Bean 初始化前后的断点出发,观察 AnnotationAwareAspectJAutoProxyCreator 在 Bean 生命周期中何时参与处理。
- 2.94 2.3AnnotationAwareAspectJAutoProxyCreator具体是怎么创建代理对象的historical
本文沿目标 Bean 的创建过程追踪自动代理创建器,观察 Spring 如何检查切面并生成代理对象。
- 2.97 PooledByteBufAllocatorhistorical
PooledByteBufAllocator 先获取线程缓存和对应的 PoolArena,再通过 PoolArena 分配内存。笔记沿这两个阶段追踪实现。
- 2.98 PoolThreadCachehistorical
PoolThreadCache 为不同大小的内存区域创建缓存。笔记查看 tiny、small 和 normal 三类 MemoryRegionCache 的初始化。