Code example for XmlBeanFactory

0
		return sessionFactory;
	} 
 
	public static void readXml2() { 
		Resource cr = new ClassPathResource("applicationContext.xml");
		BeanFactory bf = new XmlBeanFactory(cr);
 
	} 
 
	public static SessionFactory GetSessionFactoryForWeb() {
		// ClassPathXmlApplicationContext[只能读放在web-info/classes目录下的配置文件] 
		ApplicationContext context = new ClassPathXmlApplicationContext(
				new String[] { " /applicationContext.xml" });
		BeanFactory factory = new XmlBeanFactory((Resource) context);
		SessionFactory sessionFactory = (SessionFactory) factory
				.getBean("sessionFactory");
		return sessionFactory;
	} 
 
	public static SessionFactory GetSessionFactory() {