zoukankan      html  css  js  c++  java
  • ssm的beans.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: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-4.0.xsd
    		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd">
     <!-- 配置扫描包  -->
        <context:component-scan base-package="com.offcn" >
         <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
         <context:exclude-filter type="annotation" expression="org.springframework.web.bind.annotation.ControllerAdvice"/>
        </context:component-scan>
        
        <!-- 加载properties配置文件 -->
        <context:property-placeholder location="classpath:jdbc.properties"/>
        <!-- 配置数据源  -->
        <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
    		<property name="username" value="${jdbc.userName}"></property>
    	    <property name="password" value="${jdbc.password}"></property>
    		<property name="url" value="${jdbc.jdbcUrl}"></property>
    		<property name="driverClassName" value="${jdbc.driverClass}"></property>
        </bean>
        
        
        <!-- 配置数据源事务管理器  -->
        <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
          <property name="dataSource" ref="dataSource"></property>
        </bean>
        
        <!-- Spring整合MyBatis以下两步  -->
         <!-- 加载mybatis全局配置文件,生成sqlSessionFactory对象 -->
        <bean class="org.mybatis.spring.SqlSessionFactoryBean">
          <property name="dataSource" ref="dataSource"></property>
          <property name="configLocation" value="classpath:mybatis-config.xml"></property>
        </bean>
        
        <!-- 配置Mapper接口 -->
        <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
          <property name="basePackage" value="com.offcn.dao"></property>
        </bean>
        
        
        <!-- 开启基于注解的事务支持 -->
        <tx:annotation-driven transaction-manager="transactionManager"/>
    
    </beans>
    
  • 相关阅读:
    wpf 文字动态动画效果
    c# 使用 Tchart控件之数据绑定
    Linq to sql学习之查询句法
    非常有用的查询所有SqlServer数据库字典的操作
    利用WPF建立自适应窗口大小布局的WinForm窗口
    SqlMethods
    wpf 炫彩动画效果简单实例
    SetBkMode与SetBkColor理解
    Windows的字体LOGFONT
    GetWindowRect和GetWindDC GetClientRect和GetDC 在标题栏输入文字
  • 原文地址:https://www.cnblogs.com/cmxblog/p/11891912.html
Copyright © 2011-2022 走看看