ApplicationStartedEvent与ContextStartedEvent有区别吗?
source link: https://blog.didispace.com/difference-between-applicationstartedevent-contextstartedevent/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
ApplicationStartedEvent与ContextStartedEvent有区别吗?
大家好,我是DD!
今天跟大家聊聊这个问题:ApplicationStartedEvent与ContextStartedEvent有区别吗?
对了,最近花了几周时间,把SpringForAll社区 3.0上线了,社区的建设目标与之前一样,希望能够构建一个垂直于Java开发者的高质量技术社区!目前,已经有接近1000名注册用户,每天也有不少读者会发布一些帖子,技术氛围已经初步形成。
如果你正在学习Java、Spring,你可以在这里分享你的见解,碰到的问题以及帮助别人解决问题。
后面,我会持续精选一些,我觉得有意思的问题,在这里继续给大家分享一下!
关于这个问题,其实就是Spring和Spring Boot事件机制的理解。
虽然Spring Boot的基础是Spring,但Spring Boot并没有直接使用Spring中定义的常用事件,而是重新定义了一批。
它们都是继承自SpringApplicationEvent
,而SpringApplicationEvent
继承自ApplicationEvent
,SpringApplicationEvent
与题主提到的ContextStartedEvent
是平级的。
所以,Spring Boot中应该是没用到ContextStartedEvent的
。
Spring Boot具体有哪些事件可以看看之前在2.0发布的时候写过一篇:《Spring Boot 2.0 新特性(二):新增事件ApplicationStartedEvent
》
ApplicationStartingEvent
ApplicationEnvironmentPreparedEvent
ApplicationPreparedEvent
ApplicationStartedEvent <= 新增的事件
ApplicationReadyEvent
ApplicationFailedEvent
今天的分享就到这里!如果您学习过程中如遇困难?可以加入我们超高质量的Spring技术交流群,参与交流与讨论,更好的学习与进步!更多Spring Boot教程可以点击直达!,欢迎收藏与转发支持!
以上是我的认识,如果有不对的地方,也欢迎评论区指出,一起学习一起进阶!
Recommend
-
25
-
41
有问题,上知乎。知乎是中文互联网知名知识分享平台,以「知识连接一切」为愿景,致力于构建一个人人都可以便捷接入的知识分享网络,让人们便捷地与世界分享知识、经验和见解,发现更大的世界。
-
75
-
41
来源:柳叶刀TheLancet1月24日,《柳叶刀》及《柳叶刀-感染病学》同时发表两篇新型冠状病毒病例研究,第一时间展示了首批武汉感染者的数据、以及病毒在武汉-深圳之间的人传人和跨城市传播情况。此外,数名专家对这两项研究发表了评论,认为目前
-
3
把螺栓设计当家具?不知道坐下去和搓衣板有没有区别 有人认为,家具产品是最能体现设计师个性和思想的设计,因为它实用,最贴近生活;也因为设计来源于生活,为生活而服务。 来自首尔的设计师Hyunseog oh和Sangmyung y...
-
6
刘备入蜀和吕蒙白衣渡江有区别吗? - 步行街主干道 - 虎扑社区 刘备入蜀和吕蒙白衣渡江有区别吗? 124回复 /26亮 57944 浏览 ...
-
11
V2EX › NGINX nginx 的 access_log 设置成 off 和/dev/null,二者有区别吗? kisshere · 1...
-
4
V2EX › Go 编程语言 麻烦问一下 println 和 print\n 底层有区别吗 saleacy · 12 小时 35...
-
3
V2EX › 程序员 PHP 的 curl 和 Linux 的 curl 命令有区别吗?
-
5
V2EX › 路由器 重新弄了家里的网络,不知道这 2 种是否有区别?
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK