main方法中同时加载多个Spring文件

public static void main(String[] args) {
 // 初始化ClassPathXmlApplicationContext
   ApplicationContext context=new FileSystemXmlApplicationContext
   (  //配置文件用逗号隔开
        new String[] {
            "/WebRoot/WEB-INF/applicationContext.xml",
                  "/WebRoot/WEB-INF/heguikunSpring.xml"
          }
   );

   PxglBiz dao =(PxglBiz) context.getBean("pxlBizImpl");
   List list = dao.Query("from Psxm", 0, 100);
   if (list != null) {
     System.out.println(list.size());
   } else {
     System.out.println("空");
   }
}

你可能感兴趣的:(DAO,spring,String,list,null)