zoukankan      html  css  js  c++  java
  • SSH之applicationContext.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:context="http://www.springframework.org/schema/context"
    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.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context.xsd
    http://www.springframework.org/schema/aop
    http://www.springframework.org/schema/aop/spring-aop.xsd
    http://www.springframework.org/schema/tx 
    http://www.springframework.org/schema/tx/spring-tx.xsd">
    
    <!-- 开启注解的扫描 -->
    <context:component-scan base-package="com.itheima"/>
    
    <!-- 配置C3P0的连接池 -->
    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
    <property name="driverClass" value="com.mysql.jdbc.Driver"/>
    <property name="jdbcUrl" value="jdbc:mysql:///day68"/>
    <property name="user" value="root"/>
    <property name="password" value="root"/>
    </bean>
    
    <!-- Spring整合hibernate框架 -->
    <bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
    <!-- 注入连接池 -->
    <property name="dataSource" ref="dataSource"/>
    <!-- 注入属性 -->
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
    <prop key="hibernate.show_sql">true</prop>
    <prop key="hibernate.format_sql">true</prop>
    <prop key="hibernate.hbm2ddl.auto">none</prop>
    <prop key="hibernate.current_session_context_class">org.springframework.orm.hibernate5.SpringSessionContext</prop>
    </props>
    </property>
    <!-- 注入扫描entity注解 -->
    <property name="packagesToScan">
    <array>
    <value>com</value>
    </array>
    </property>
    </bean>
    
    <!-- 先配置模板 -->
    <bean id="hibernateTemplate" class="org.springframework.orm.hibernate5.HibernateTemplate">
    <property name="sessionFactory" ref="sessionFactory"/>
    </bean>
    
    <!-- 配置事务 -->
    <bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory"/>
    </bean>
    
    <!-- 配置事务通知 -->
    <tx:advice id="myAdvice" transaction-manager="transactionManager">
    <tx:attributes>
    <!-- <tx:method name="save*" isolation="DEFAULT" propagation="REQUIRED"/>
    <tx:method name="update*" isolation="DEFAULT" propagation="REQUIRED"/>
    <tx:method name="delete*" isolation="DEFAULT" propagation="REQUIRED"/>
    <tx:method name="find*" read-only="true"/> -->
    <tx:method name="*" isolation="DEFAULT" propagation="REQUIRED"/>
    </tx:attributes>
    </tx:advice>
    
    <!-- 配置AOP增强 -->
    <aop:config>
    <aop:advisor advice-ref="myAdvice" pointcut="execution(* com.itheima.*.service.*ServiceImpl.*(..))"/>
    </aop:config>
    </beans>
    
     
  • 相关阅读:
    tcpreplay安装使用经验
    Linux 性能优化之 IO 子系统 系列 图
    深入理解Fsync----JBD内核调试 专业打杂程序员 @github yy哥
    LINUX 文件系统JBD ----深入理解Fsync
    通过查看mysql 配置参数、状态来优化你的mysql
    linux IO 内核参数调优 之 原理和参数介绍
    Mysql参数详解
    Mysql show Status参数详解
    MYSQL: Handler_read_%参数说明
    mysql的优化措施,从sql优化做起
  • 原文地址:https://www.cnblogs.com/qiqimu/p/7677850.html
Copyright © 2011-2022 走看看