紫夏秋 2015-05-20 09:45 采纳率: 100%
浏览 1682
已采纳

求大神解救application如何配置问题

图片说明
图片说明

  • 写回答

1条回答 默认 最新

  • 菜鸟程序元 2015-05-21 02:39
    关注

    <?xml version="1.0" encoding="UTF-8"?>
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
    xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
    http://www.springframework.org/schema/tx
    http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
    http://www.springframework.org/schema/aop
    http://www.springframework.org/schema/aop/spring-aop-3.1.xsd">

    <!-- 配置数据源 -->
    <bean id="basicDataSource" class="org.apache.commons.dbcp.BasicDataSource">
        <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
        <property name="url" value="jdbc:oracle:thin:@localhost:1521:orcl" />
        <property name="username" value="scott" />
        <property name="password" value="tiger" />
    </bean>
    
    <!-- 配置会话工厂 -->
    <bean id="sessionFactory"
        class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    
        <!-- 引用的数据源 -->
        <property name="dataSource" ref="basicDataSource" />
    
        <!-- 对于hibernate框架要做的配置 -->
        <property name="hibernateProperties">
            <props>
                <!-- 方言 -->
                <prop key="hibernate.dlalect">org.hibernate.dialect.Oracle10gDialect</prop>
                <!-- 是否显示SQL语句 -->
                <prop key="hibernate.show_sql">false</prop>
                <!-- 是否格式化SQL -->
                <prop key="hibernate.format_sql">false</prop>
            </props>
        </property>
    
        <!-- 指定映射文件的路径 -->
        <property name="mappingDirectoryLocations">
            <list>
                <value>classpath:com/bdqn/entity/</value>
            </list>
        </property>
    </bean>
    
    <!-- Dao -->
    <bean id="customerDao" class="com.bdqn.dao.impl.CustomerDaoImpl">
        <property name="sessionFactory" ref="sessionFactory"></property>
    </bean>
    <bean id="deptDao" class="com.bdqn.dao.impl.DeptDaoImpl">
        <property name="sessionFactory" ref="sessionFactory"></property>
    </bean>
    
    <!-- Service -->
    <bean id="deptService" class="com.bdqn.service.impl.DeptServiceImpl">
        <property name="deptDao" ref="deptDao"></property>
    </bean>
    <bean id="customerService" class="com.bdqn.service.impl.CustomerServiceImpl">
        <property name="customerDao" ref="customerDao"></property>
    </bean>
    
    <!-- Action -->
    <bean id="customerAction" class="com.bdqn.action.CustomerAction" scope="prototype">
        <property name="customerService" ref="customerService"></property>
        <property name="deptService" ref="deptService"></property>
    </bean> 
    
    <!-- 配置事务 -->
    <bean id="tx"
        class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>
    
    <!-- 定义传播特性  -->
    <tx:advice id="txAdvice" transaction-manager="tx">
        <tx:attributes>
            <tx:method name="find*" read-only="true" />
            <tx:method name="search*" read-only="true" />
            <tx:method name="query*" read-only="true" />
            <tx:method name="get*" read-only="true" />
            <tx:method name="add*" propagation="REQUIRED" />
            <tx:method name="save*" propagation="REQUIRED" />
            <tx:method name="insert*" propagation="REQUIRED" />
            <tx:method name="del*" propagation="REQUIRED" />
            <tx:method name="remove*" propagation="REQUIRED" />
            <tx:method name="update*" propagation="REQUIRED" />
            <tx:method name="modify*" propagation="REQUIRED" />
            <tx:method name="*" propagation="REQUIRED" />
        </tx:attributes>
    </tx:advice>
    
    <aop:config>
        <aop:pointcut expression="execution(public * com.bdqn.service.impl.*.*(..))"
            id="pc" />
        <aop:advisor advice-ref="txAdvice" pointcut-ref="pc" />
    </aop:config>
    

    
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 腾讯云如何建立同一个项目中物模型之间的联系
  • ¥30 VMware 云桌面水印如何添加
  • ¥15 用ns3仿真出5G核心网网元
  • ¥15 matlab答疑 关于海上风电的爬坡事件检测
  • ¥88 python部署量化回测异常问题
  • ¥30 酬劳2w元求合作写文章
  • ¥15 在现有系统基础上增加功能
  • ¥15 远程桌面文档内容复制粘贴,格式会变化
  • ¥15 这种微信登录授权 谁可以做啊
  • ¥15 请问我该如何添加自己的数据去运行蚁群算法代码