zoukankan      html  css  js  c++  java
  • mybaties 的 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:aop="http://www.springframework.org/schema/aop"
    xmlns:jdbc="http://www.springframework.org/schema/jdbc"
    xmlns:p="http://www.springframework.org/schema/p"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.3.xsd
    http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd">

    <context:annotation-config></context:annotation-config>
    <context:component-scan base-package="com"></context:component-scan>


    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
    <property name="driverClass" value="com.mysql.jdbc.Driver"></property>
    <property name="jdbcUrl" value="jdbc:mysql:///spring"></property>
    <property name="user" value="root"></property>
    <property name="password" value="123"></property>
    <property name="minPoolSize" value="10"></property>
    <property name="maxPoolSize" value="200"></property>
    </bean>

    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <property name="dataSource" ref="dataSource"></property>
    </bean>

    <bean id="sqlsessionfactory" class="org.mybatis.spring.SqlSessionFactoryBean">
    <property name="dataSource" ref="dataSource"></property>
    </bean>

    <!-- <bean id="factorybean" class="org.mybatis.spring.mapper.MapperFactoryBean">
    <property name="mapperInterface" value="com.test.UserMapper"></property>

    <property name="sqlSessionFactory" ref="sqlsessionfactory"></property>
    </bean> -->
    <!-- 扫描包下的所有Mapper接口 -->
    <bean id="factorybean" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
    <property name="basePackage" value="com.test"></property>
    <property name="sqlSessionFactory" ref="sqlsessionfactory"></property>
    </bean>


    <!-- 配置声明式事务 -->
    <tx:advice id="txadvice" transaction-manager="transactionManager">
    <!-- <tx:attributes>
    <tx:method name="*" propagation="REQUIRED" read-only="true"/>
    </tx:attributes> -->
    </tx:advice>

    <aop:config >
    <aop:pointcut expression="execution(* com.test.Test.*(..))" id="mypointcut"/>
    <aop:advisor advice-ref="txadvice" pointcut-ref="mypointcut"/>
    </aop:config>
    </beans>

  • 相关阅读:
    (step4.3.8)hdu 2181(哈密顿绕行世界问题——DFS)
    两款商业拓扑发现软件siteview和ElementSentry的比较
    20岁到30岁,我拿十年做什么
    新浪微博私信,即时聊天接口研究
    “adb server is out of date. killing.... ADB server didn't ACK * failed to start daemon * ”
    【Java&Android开源库代码剖析】のandroid-smart-image-view
    dns智能解析对网站排名的影响
    SQL Server 权限管理
    objective-c 中数据类型之四 字典(NSDictionary)
    IOS总结_实现UIButton的图文混排(二)
  • 原文地址:https://www.cnblogs.com/xyd51cto/p/7718428.html
Copyright © 2011-2022 走看看