对“观察者模式”和“订阅发布模式”的理解

2020-04-10  本文已影响0人  邮差在行动

具体含义不介绍,只谈谈自己的理解,如有理解错误请指出:


对比图

Spring官方文档 Event handling in the ApplicationContext is provided through the ApplicationEvent class and the ApplicationListener interface. If a bean that implements the ApplicationListener interface is deployed into the context, every time an ApplicationEvent gets published to the ApplicationContext, that bean is notified. Essentially, this is the standard Observer design pattern.

设计模式没有好坏之分,而是要根据实际应用选择相应的模式。

上一篇 下一篇

猜你喜欢

热点阅读