1.三種方式實現觀察者模式 及 Spring中的事件編程模型
https://www.jianshu.com/p/5e72c6b76c72
2.Spring中使用到的設計模式(十一)----觀察者模式
https://www.pianshen.com/article/56041278424/
3.spring事件驅動模型--觀察者模式在spring中的應用
https://www.cnblogs.com/fingerboy/p/6393644.html
spring的事件驅動模型使用的是觀察者模式
通過ApplicationEvent抽象類和ApplicationListener接口,可以實現ApplicationContext事件處理
監聽器在處理Event時,通常會進行判斷傳入的Event是不是自己所想要處理的,使用instanceof關鍵字
ApplicationEventMulticaster事件廣播器實現了監聽器的註冊,一般不需要我們實現,只需要顯示的調用applicationcontext.publisherEvent方法即可