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

          10月5日,今天玩了一下把 Service層的實力注入到Action里面,我的ServiceLocator類也終于可以睡覺去了.
          posted on 2006-07-10 14:53 pear 閱讀(430) 評論(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");  回復  更多評論   
           
          主站蜘蛛池模板: 亳州市| 浏阳市| 赞皇县| 宾阳县| 濮阳市| 松江区| 大渡口区| 读书| 宁德市| 南乐县| 莲花县| 连江县| 望奎县| 北安市| 临城县| 象山县| 财经| 格尔木市| 赤水市| 洪雅县| 东至县| 屯门区| 武宣县| 临海市| 论坛| 曲阜市| 五寨县| 仁化县| 左云县| 台江县| 新蔡县| 潞城市| 海盐县| 灵宝市| 石楼县| 句容市| 浠水县| 屯昌县| 固始县| 正阳县| 长丰县|