SSH 整合关键配置文件

applicationContext.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
    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">

    <!-- sessionFactory -->
    <bean id="sessionFactory"
        class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        <property name="configLocation" value="classpath:hibernate.cfg.xml">
        </property>
    </bean>

    <!-- dao -->
    <bean id="UserinfoDAO" class="com.dao.impl.UserinfoDaoImpl">
        <property name="sessionFactory">
            <ref bean="sessionFactory"></ref>
        </property>
    </bean>
    <bean id="PositionDAO" class="com.dao.impl.PositionDAO">
        <property name="sessionFactory">
            <ref bean="sessionFactory"></ref>
        </property>
    </bean>
    <bean id="DeptDAO" class="com.dao.impl.DeptDAO">
        <property name="sessionFactory">
            <ref bean="sessionFactory"></ref>
        </property>
    </bean>
    <bean id="EmployeeDAO" class="com.dao.impl.EmployeeDaoImpl">
        <property name="sessionFactory">
            <ref bean="sessionFactory"></ref>
        </property>
    </bean>





    <!-- ===============biz=============== -->
    <bean id="All_Biz" class="com.biz.impl.All_Biz">
        <property name="empDao" ref="EmployeeDAO"></property>
        <property name="uiDao" ref="UserinfoDAO"></property>
    </bean>

    <bean id="EmployeeBiz" class="com.biz.impl.EmployeeBizImpl" parent="All_Biz"></bean>
    <bean id="UserInfoBiz" class="com.biz.impl.login_UserInfo_BizImpl" parent="All_Biz"></bean>


    <!-- ===============action=============== -->
    <bean id="Employee_action" class="com.action.All_Action">
        <property name="empbiz" ref="EmployeeBiz"></property>
        <property name="uibiz" ref="UserInfoBiz"></property>
    </bean>

    <bean id="employee_action" class="com.action.Employee_Action" parent="Employee_action" scope="prototype"></bean>
    <bean id="login_action" class="com.action.login_UserInfo_Action" parent="Employee_action" scope="prototype"></bean>




    <!-- ===================通用事务====================== -->
    <bean id="transactionManager"
        class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory"></property>
    </bean>
    <tx:advice id="tx">
        <tx:attributes>
            <tx:method name="add*" propagation="REQUIRED" />
            <tx:method name="delete*" propagation="REQUIRED" />
            <tx:method name="update*" propagation="REQUIRED" />
            <tx:method name="login*" propagation="SUPPORTS" />
            <tx:method name="*" propagation="SUPPORTS" />
        </tx:attributes>
    </tx:advice>
    <aop:config>
        <aop:pointcut expression="execution(* com.biz.impl.*.*(..))"
            id="bizMethod" />
        <aop:advisor advice-ref="tx" pointcut-ref="bizMethod" />
    </aop:config>
</beans>

hibernate.cfg.xml

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<!-- Generated by MyEclipse Hibernate Tools.                   -->
<hibernate-configuration>

    <session-factory>
        <property name="dialect
            org.hibernate.dialect.Oracle9Dialect
        </property>
        <property name="connection.url">jdbc:oracle:thin:@localhost:1522:accp11g</property>
        <property name="connection.username">baiyu</property>
        <property name="connection.password">123</property>
        <property name="connection.driver_class">
            oracle.jdbc.driver.OracleDriver
        </property>
        <property name="myeclipse.connection.profile">baiyu</property>
        <property name="show_sql">true</property>
        <property name="format_sql">true</property>
        <mapping resource="com/orm/Userinfo.hbm.xml" />
        <mapping resource="com/orm/Position.hbm.xml" />
        <mapping resource="com/orm/Dept.hbm.xml" />
        <mapping resource="com/orm/Employee.hbm.xml" />

    </session-factory>

</hibernate-configuration>

struts.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
    <include file="com/config/struts-list.xml"></include>
    <include file="com/config/struts-login.xml"></include>
</struts>    
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Rkatsiteli

你的鼓励将是我创作的最大动力!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值