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

          10月5日,今天玩了一下把 Service層的實力注入到Action里面,我的ServiceLocator類也終于可以睡覺去了.
          posted on 2006-07-10 14:53 pear 閱讀(422) 評論(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");  回復  更多評論   
           
          主站蜘蛛池模板: 余江县| 新沂市| 镇平县| 辽阳县| 成都市| 大港区| 隆尧县| 上虞市| 祁阳县| 无锡市| 通道| 自贡市| 南雄市| 上饶县| 七台河市| 承德市| 宜丰县| 固安县| 且末县| 镇平县| 尖扎县| 宁国市| 镶黄旗| 扬州市| 罗甸县| 城固县| 栾城县| 中超| 抚宁县| 珲春市| 孟津县| 巴中市| 宜宾县| 桃江县| 南阳市| 阳泉市| 昂仁县| 衡东县| 苍山县| 塔城市| 华坪县|