Sshs环境配置:

Ssh环境配置:

 

 

1.       配置spring

src目录下创建springconfig的文件夹。

 

备注:

创建sm文件夹用于对系统管理的信息进行配置。截图如下:

 

Sm-action:action中信息进行配置。如业务层的对象

Sm-beans.xml:配置业务层的信息

Sm-dao.xml:配置dao层的信息

 

b.将有关的springjar包,导入到lib下的文件中。.

 

 

2.       配置hibernate

a.hibernatejar包导入到lib的文件中去。

Bsrc目录下创建hibernate的配置文件。配置有关数据库的访问信息。

3.       配置struuts

a. strutsjar包导入到lib的文件中去。

b. src目录下添加strutsXml中的文件。

c. 配置webXml文件信息。详细如下:

 

配置详细介绍:

applicationContext-commons.xml

 

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xmlns:aop="http://www.springframework.org/schema/aop"

    xmlns:tx="http://www.springframework.org/schema/tx"

    xsi:schemaLocation="

           http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd

           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">

 

 

    <bean id="dataSource"

       class="org.springframework.jdbc.datasource.DriverManagerDataSource">

       <property name="driverClassName"

           value="com.microsoft.jdbc.sqlserver.SQLServerDriver" />

       <property name="url"

           value="jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=exeerp" />

       <property name="username" value="sa" />

       <property name="password" value="" />

    </bean>

 

    <bean id="jdbcTemplate"

       class="org.springframework.jdbc.core.JdbcTemplate">

       <property name="dataSource" ref="dataSource" />

    </bean>

 

    <!-- 配置公共业务层 -->

    <bean id="baseManager"

       class="com.exeerp.pub.biz.AbstractBaseManager" abstract="true">

       <property name="baseDAO" ref="baseDAO"></property>

    </bean>

 

    <bean id="baseDAO" class="com.exeerp.pub.dao.BaseDAOImpl">

       <property name="hibernateTemplate" ref="hibernateTemplate" />

    </bean>

 

    <bean id="hibernateTemplate"

       class="org.springframework.orm.hibernate3.HibernateTemplate">

       <property name="sessionFactory" ref="sessionFactory" />

    </bean>

 

    <bean id="sessionFactory"

       class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">

       <property name="dataSource" ref="dataSource" />

       <property name="mappingResources">

           <list>

              <value>com/exeerp/sm/bean/Employee.hbm.xml</value>

              <value>com/exeerp/sm/bean/Department.hbm.xml</value>

              <value>com/exeerp/sm/bean/Role.hbm.xml</value>

              <value>com/exeerp/sm/bean/Popedom.hbm.xml</value>

           </list>

       </property>

       <property name="hibernateProperties">

           <props>

              <prop key="hibernate.dialect">

                  org.hibernate.dialect.SQLServerDialect

              </prop>

              <prop key="hibernate.show_sql">true</prop>

              <prop key="hibernate.use_sql_comments">true</prop>

              <prop key="hibernate.format_sql">true</prop>

              <prop key="hibernate.generate_statistics">true</prop>

           </props>

       </property>

 

    </bean>

 

    <bean id="transactionManager"

       class="org.springframework.orm.hibernate3.HibernateTransactionManager">

       <property name="sessionFactory" ref="sessionFactory"></property>

    </bean>

 

</beans>

 

applicationContext-actions.xml

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xmlns:aop="http://www.springframework.org/schema/aop"

    xmlns:tx="http://www.springframework.org/schema/tx"

    xsi:schemaLocation="

           http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

   

你可能感兴趣的:(spring,AOP,bean,Hibernate,配置管理)