1。ServiceLocator 中一般包含static方法
          2。ServiceLocator角色 ?如果讓TopBaseAction承擔(可以非靜態,也很方便)
          3。ServiceLocator的角色和SessionFactory有些類似(都是用工廠模式)

          10月5日,今天玩了一下把 Service層的實力注入到Action里面,我的ServiceLocator類也終于可以睡覺去了.
          posted on 2006-07-10 14:53 pear 閱讀(435) 評論(1)  編輯  收藏 所屬分類: 心得體會
          Comments
          • # re: ServiceLocator 中一般包含static方法
            pear
            Posted @ 2006-10-05 14:24
            三種情況的getBean()呵呵,可以不寫了.
            ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);
            ProductService productService = (ProductService) context.getBean("myProductService");
            ApplicationContext context =
            new FileSystemXmlApplicationContext("C:/myContext.xml");
            ProductService productService =
            (ProductService) context.getBean("myProductService");
            ApplicationContext context =
            new ClassPathXmlApplicationContext("myContext.xml");
            ProductService productService =
            (ProductService) context.getBean("myProductService");  回復  更多評論   
           
          主站蜘蛛池模板: 香港 | 綦江县| 陆良县| 扎赉特旗| 丹东市| 清徐县| 巫溪县| 积石山| 鹤山市| 景泰县| 大同市| 乐清市| 大埔县| 红河县| 信宜市| 甘孜县| 洞口县| 长沙市| 姜堰市| 昭平县| 建瓯市| 栾城县| 通州区| 元阳县| 淮滨县| 唐海县| 黄陵县| 文成县| 同仁县| 长葛市| 荃湾区| 涪陵区| 永和县| 兴安县| 广河县| 调兵山市| 卢氏县| 清新县| 琼中| 盘山县| 郎溪县|