整合的时候,Spring管理hibernate的sessionfactory,struts2的action。当然action有时候是有状态的,有时候无状态,可在Spring配置里加入scope="singleton"或者scope="prototype"。
现在看看如何配置。
配置WEB.XML(添加上struts2的过滤器和Spring的监听器)
配置Spring文件applicationContext.xml(IOC管理了Action,Sessionfactory,Bean),Spring文件已经将hibernate的信息都配置了,所以hibernate.cfg.xml可以为空白的
配置struts2文件struts.xml