ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(event.getServletContext());
每一次调用这个就会使hibernate建立一个连接池,
在applicationContext-hibernate.xml中有数据库连接信息,数据库表映射信息(sessionfactory)和hibernateProperties
但是如果通过这种方式获取,写成单独的
ApplicationContext ac = new FileSystemXmlApplicationContext(path);
path是applicationContext-xxx.xml 不包括applicationContext-hibernate.xml的内容
就会报出
No bean named 'sessionFactory' is defined错误