1, web.xml中配置spring监听类
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
2,需要一个struts2-spring-plugin.jar
3,srping整合hibernate 配置数据库连接 Session工厂
<!-- 配置数据连接类 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="org.gjt.mm.mysql.Driver">
</property>
<property name="url" value="jdbc:mysql://localhost:3306/hibernate"></property>
<property name="username" value="root"></property>
<property name="password" value="1"></property>
</bean>
<!-- 配置session工厂类 -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
<property name="mappingResources">
<value>org/it/po/User.hbm.xml</value>
</property>
</bean>
注:只是一些简单 大概流程 只供忘记时参考.