1。ServiceLocator 中一般包含static方法
2。ServiceLocator角色  如果让TopBaseAction承担(可以非静态,也很方便)
3。ServiceLocator的角色和SessionFactory有些类似(都是用工厂模式)

10月5日,今天玩了一下把 Service层的实力注入到Action里面,我的ServiceLocator类也终于可以睡觉去了.
posted on 2006-07-10 14:53 pear 阅读(412) 评论(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");  回复  更多评论   

只有注册用户登录后才能发表评论。


网站导航: