spring基于注解的源码解析
文章平均质量分 71
hhcui重名了
这个作者很懒,什么都没留下…
展开
-
Spring如何解决循环依赖
Spring如何解决循环依赖先建立循环依赖的demo代码dao中引用了service,service引用了dao。Dao代码@Componentpublic class MyDao { @Autowired MyService service; public MyService getService() { return service; } public void setService(MyService service) { this.service = servic原创 2021-05-19 16:39:14 · 141 阅读 · 0 评论 -
基于注解的spring源码解析之读懂refresh方法,refresh方法的总体流程
基于注解的spring源码解析2-读懂refresh方法ynchronized (this.startupShutdownMonitor) { // Prepare this context for refreshing. ////准备工作包括设置启动时间,是否激活标识位, // 初始化属性源(property source)配置 prepareRefresh(); // Tell the subclass to refresh the internal bean fact原创 2021-05-17 11:30:24 · 273 阅读 · 1 评论 -
基于注解的spring源码解析之总体流程
基于注解的spring源码解析1-总体流程##总体流程图Demo代码public class Main { public static void main(String[] args) { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Config.class); MyService service = (MyService) context.getBean("serv原创 2021-05-17 11:05:16 · 146 阅读 · 0 评论 -
基于注解的spring源码解析之读懂refresh方法之invokeBeanFactoryPostProcessors()
基于注解的spring源码解析之读懂refresh方法之invokeBeanFactoryPostProcessors()进入方法invokeBeanFactoryPostProcessors() protected void invokeBeanFactoryPostProcessors(ConfigurableListableBeanFactory beanFactory) { //获取自定义的,手工add进去list的beanFactoryProcessors PostProcessorR原创 2021-05-17 14:55:50 · 85 阅读 · 0 评论 -
Spring提供的扩展点以及案例
Spring提供的扩展点以及案例1 BeanFactoryPostProcessor/** * spring的扩展点之一 * 实现该接口,可以在spring的bean创建之前修改bean的定义属性。 * spring允许BeanFactoryPostProcessor在容器实例化任何其它bean之前读取配置元数据, * 并可以根据需要进行修改,例如可以把bean的scope从singleton改为prototype,也可以把property的值给修改掉。 * 可以同时配置多个BeanFacto原创 2021-05-18 17:53:32 · 381 阅读 · 0 评论 -
基于注解的spring源码解析之读懂refresh方法之finishBeanFactoryInitialization(beanFactory)
基于注解的spring源码解析之读懂refresh方法之finishBeanFactoryInitialization(beanFactory)接着上一篇文章,BD里面现在有8个属性实例化bean进入finishBeanFactoryInitialization(beanFactory)方法,安装流程图一路点进去,获得bean的构造方法,然后进行实例化。填充属性populateBean(beanName, mbd, instanceWrapper);...原创 2021-05-17 21:47:06 · 125 阅读 · 0 评论