浏览 2876 次
锁定老帖子 主题:SSH框架整合之配置文件
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2008-12-09
最后修改:2008-12-09
1.type="org.springframework.web.struts.DelegatingActionProxy" 2.<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn"> <set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml" /> </plug-in> Spring整合Struts、Hibernate的完整配置文件 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans default-lazy-init = "true"> <!-- 数据库连接的取得 --> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName"> <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value> </property> <property name="url"> <value>jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=db_personManager</value> </property> <property name="username"> <value>sa</value> </property> </bean> <!-- Spring支持Hibernate框架的配置,得到SessionFactory--> <bean id="localSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSource" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> org.hibernate.dialect.SQLServerDialect </prop> </props> </property> <property name="mappingResources"> <list> <value>com/hr/hibernate/pojo/Manager.hbm.xml</value> </list> </property> </bean> <!-- 注册DAO工具类 --> <bean id="daoutil" class="com.hr.hibernate.dao.HiberDaoUtil" singleton="false"> <property name="sessionFactory"> <ref bean="localSessionFactory" /> </property> </bean> <!-- **************************************Spring IOC **************************************--> <bean id="manager_dao" class="com.hr.hibernate.dao.ManagerDAOImpl" singleton="false"> <property name="sessionFactory"> <ref bean="localSessionFactory" /> </property> <property name="daoutil"> <ref local="daoutil"/> </property> </bean> <bean id="manager_service" class="com.hr.service.ManagerServiceImpl"> <property name="manager_dao"> <ref local="manager_dao"/> </property> </bean> <bean name="/manager" class="com.hr.struts.action.ManagerAction"> <property name="manager_service"> <ref local="manager_service"/> </property> </bean> </beans> 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |