posts - 120,  comments - 19,  trackbacks - 0
          Spring本身有ApplicationEvent和ApplicationListener,ApplicationContext可以發布ApplicationEvent,然后ApplicationListener監聽event并做出相應動作。但是這里的ApplicationEvent有個陷阱,它的傳播范圍和當前的ApplicationContext的級別有關,并不是系統中所有的ApplicationListener都可以收到所有的Event
          ?
          假設當前系統為一個典型的Struts+Spring+Hibernate系統,那么系統中至少會有兩個ApplicationContext存在,一個時root ApplicationContext,一個是Servlet的ApplicationContext。root ApplicationContext中包含你所有在webApplicationContext.xml中定義的bean,Servlet的ApplicationContext則包含有所有在action-servlet.xml中定義的bean,需要注意的是root context中的bean是無法看到servlet context中的bean的而在servlet context中的ApplicationListener也無法收到root context發布的ApplicationEvent

          http://sweetriver.spaces.live.com/blog/cns!367370EB9A9B2807!129.entry


          posted on 2006-09-04 09:10 阿成 閱讀(558) 評論(0)  編輯  收藏 所屬分類: Spring
          主站蜘蛛池模板: 永安市| 厦门市| 明光市| 宁阳县| 搜索| 乐业县| 囊谦县| 都昌县| 那坡县| 中阳县| 桦甸市| 莱芜市| 蕉岭县| 双流县| 淅川县| 兴山县| 苍梧县| 沂源县| 新化县| 上虞市| 乌拉特中旗| 沙洋县| 望奎县| 澜沧| 大石桥市| 左贡县| 德安县| 措美县| 白城市| 余江县| 西和县| 乐昌市| 新竹县| 苏州市| 兴义市| 双江| 五寨县| 东辽县| 龙口市| 松滋市| 尉氏县|