- 博客(13)
- 收藏
- 关注
原创 ⑥、Spring-->refresh()-->onRefresh()
new AnnotationConfigApplicationContext(MainConfig.class);里面这个是一个空方法,在后面web需要在填补
2021-04-14 21:10:40
162
原创 ⑤、Spring-->refresh()-->initApplicationEventMulticaster()
文章目录前言直接看源码:前言initApplicationEventMulticaster()的作用 :初始化应用程序事件多播器,事件多播器ApplicationEventMulticaster、ApplicationListener、ApplicationEvent使用了发布订阅模式的设计模式ApplicationEventMulticaster 类的方法如下所示:直接看源码:具体功能就是,如果我们自己定义了applicationEventMulticaster组件或者@Bean
2021-04-14 21:07:56
182
原创 ④、Spring-->refresh()-->initMessageSource()
文章目录前言前言initMessageSource()的作用是初始化国际化文件
2021-04-14 20:30:08
124
原创 ③、Spring-->refresh()-->registerBeanPostProcessors(beanFactory);
文章目录前言前言registerBeanPostProcessors(beanFactory) 的作用是
2021-04-14 19:39:54
90
原创 ②、Spring-->refresh()-->invokeBeanFactoryPostProcessors(beanFactory);
invokeBeanFactoryPostProcessors(beanFactory);这个方法的作用是调用前面放入beanFactory beanDefinitionMap中的后置处理器
2021-04-06 23:12:21
226
1
原创 ①、Spring AnnotationConfigApplicationContext 源码分析(3) ---->refresh() 大概结构;
整个spring 框架最重要的部分就是这个方法了。这里先讲前面三个方法,后面的方法比较重要的都分开来单独讲。public void refresh() throws BeansException, IllegalStateException { synchronized (this.startupShutdownMonitor) { // Prepare this context for refreshing. /** * 准备工作: * 设置启动时间、是否激活标识位
2021-04-05 22:39:29
402
原创 Spring AnnotationConfigApplicationContext 源码分析(2) ---->register(annotatedClasses);
上一篇把this()都讲完了,这一篇讲register(annotatedClasses);其实这个方法的作用就是把配置类(下面例子中的annotatedClasses)包装为beanDefinition,之后加入到beanFactory 的beanDefinitionMap中。public AnnotationConfigApplicationContext(Class<?>... annotatedClasses) { this(); register(annotatedClas
2021-04-05 18:14:10
222
2
原创 Spring AnnotationConfigApplicationContext 源码分析(1) ---->this()
读spring 的源码还是需要跟着debug下来才比较容易理解:入口 mainpublic static void main(String[] args) { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(MainConfig.class); }new AnnotationConfigApplicationContext(MainConfig.cla
2021-04-04 17:10:16
229
原创 spring的beanFactory是怎么获取到getBean(String)和getBean(Class<T>)的?
getBean(Class requiredType)和getBean(String)的执行时序 如下图所示:
2021-04-04 15:04:54
249
转载 Navicat for MySQL中文乱码问题
mysql编码设置在数据库上右击打开console控制台,输入SHOW VARIABLES LIKE ‘%character_%’; 可以看到MySQL 相关编码的设置如下: SHOW VARIABLES LIKE ‘collation_%’; 默认就是瑞典latin1,以下是换成我们自己的编码,如utf8: 外部访问数据乱码的问题就出在这个connection连接层上,...
2018-08-17 15:19:02
189
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人