<?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:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
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.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"
default-lazy-init="true"> <!-- 自动搜索@Component,@Service,@Repository等标注的类 不搜索@Controller的类 -->
<!-- 自动扫描组件,这里要把web下面的 controller去除,它们是在spring3-servlet.xml中配置的,如果不去除会影响事务 -->
<context:component-scan base-package="cn.edu.hbcf,com.ruijie"
annotation-config="true">
<context:exclude-filter type="annotation"
expression="org.springframework.stereotype.Controller" />
</context:component-scan> <context:component-scan base-package="cn.edu.hbcf,com.ruijie"
annotation-config="true">
<context:include-filter type="annotation"
expression="org.springframework.stereotype.Service" />
</context:component-scan> <!-- enable autowire 允许自动装配 -->
<context:annotation-config /> <!-- service层的属性和配置文件读入,多个用逗号隔开 -->
<!-- controller层的属性和配置文件读入,多个用逗号隔开 -->
<context:property-placeholder
location="classpath:/jdbc.properties" />
<!-- 用于持有ApplicationContext,可以使用SpringContextHolder.getBean('xxx')的静态方法得到spring bean对象 -->
<bean class="cn.edu.hbcf.common.springmvc.SpringContextHolder"
lazy-init="false" /> <!-- ######################################################privilege数据库#################################################################### -->
<!-- 数据连接事务 -->
<bean id="privilegeTransactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="privilegeDataSource" />
<qualifier></qualifier>
</bean>
<bean id="privilegeSqlSessionFactory"
class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="privilegeDataSource" />
<!-- mybatis配置文件所在位置 -->
<property name="configLocation"
value="classpath:/sqlMap/mybatis-privilege.xml" />
<!-- 别名所在包 -->
<property name="typeAliasesPackage" value="cn.edu.hbcf"/>
</bean>
<!-- 从base 包中搜索所有下面所有 interface,并将其注册到 Spring Bean容器中,
其注册的class bean是MapperFactoryBean -->
<bean id="privilegeScannerConfigurer"
class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="sqlSessionFactory" ref="privilegeSqlSessionFactory"/>
<property name="basePackage" value="cn.edu.hbcf.privilege.dao,cn.edu.hbcf.notice.dao">
</property>
</bean> <!-- 连接事务的注解配置 -->
<tx:annotation-driven
transaction-manager="privilegeTransactionManager" /> <!-- ######################################################framework数据库#################################################################### -->
<!-- 数据连接事务 -->
<bean id="frameworkTransactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="privilegeDataSource" />
<qualifier></qualifier>
</bean>
<bean id="frameworkSqlSessionFactory"
class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="privilegeDataSource" />
<!-- mybatis配置文件所在位置 -->
<property name="configLocation"
value="classpath:/sqlMap/mybatis-framework.xml" />
<!-- 别名所在包 -->
<property name="typeAliasesPackage" value="cn.edu.hbcf"/>
</bean>
<!-- 从base 包中搜索所有下面所有 interface,并将其注册到 Spring Bean容器中,
其注册的class bean是MapperFactoryBean -->
<bean id="frameworkScannerConfigurer"
class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="sqlSessionFactory" ref="frameworkSqlSessionFactory"/>
<property name="basePackage" value="cn.edu.hbcf.framework.dao">
</property>
</bean> <!-- 连接事务的注解配置 -->
<tx:annotation-driven
transaction-manager="frameworkTransactionManager" /> <!-- ######################################################ucenter数据库#################################################################### -->
<!-- 数据连接事务 -->
<bean id="ucenterTransactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="ucenterDataSource" />
</bean>
<bean id="ucenterSqlSessionFactory"
class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="ucenterDataSource" />
<!-- mybatis配置文件所在位置 -->
<property name="configLocation"
value="classpath:/sqlMap/mybatis-ucenter.xml" />
<!-- 别名所在包 -->
<property name="typeAliasesPackage" value="cn.edu.hbcf" />
</bean>
<!-- 从base 包中搜索所有下面所有 interface,并将其注册到 Spring Bean容器中,
其注册的class bean是MapperFactoryBean-->
<bean id="ucenterScannerConfigurer"
class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="sqlSessionFactory" ref="ucenterSqlSessionFactory"/>
<property name="basePackage" value="cn.edu.hbcf.privilege.cas.dao"></property>
</bean>
<bean id="infoTransactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="infoDataSource"/>
</bean> </beans>

spring-common.xml的更多相关文章

  1. spring web.xml 难点配置总结

    web.xml web.xml是所有web项目的根源,没有它,任何web项目都启动不了,所以有必要了解相关的配置. ContextLoderListener,ContextLoaderServlet, ...

  2. spring web.xml 难点配置总结【转】

    web.xml web.xml是所有web项目的根源,没有它,任何web项目都启动不了,所以有必要了解相关的配置. ContextLoderListener,ContextLoaderServlet, ...

  3. spring applicationContext.xml

    <?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.spr ...

  4. spring读取xml配置文件(二)

    一.当spring解析完配置文件名的占位符后,就开始refresh容器 @Override public void refresh() throws BeansException, IllegalSt ...

  5. 这一次搞懂Spring的XML解析原理

    前言 Spring已经是我们Java Web开发必不可少的一个框架,其大大简化了我们的开发,提高了开发者的效率.同时,其源码对于开发者来说也是宝藏,从中我们可以学习到非常优秀的设计思想以及优雅的命名规 ...

  6. [Java] 解决spring的xml标签内不能自由增加说明的难题,方便调试、部署时进行批量屏蔽

    作者:zyl910 以往我们想在spring的xml配置文件中增加说明文本时,只能使用xml注释(<!-- 注释 -->).这对于"调试.部署时想批量屏蔽部分bean" ...

  7. Spring 通过XML配置文件以及通过注解形式来AOP 来实现前置,环绕,异常通知,返回后通知,后通知

    本节主要内容: 一.Spring 通过XML配置文件形式来AOP 来实现前置,环绕,异常通知     1. Spring AOP  前置通知 XML配置使用案例     2. Spring AOP   ...

  8. Spring AOP:面向切面编程,AspectJ,是基于spring 的xml文件的方法

    导包等不在赘述: 建立一个接口:ArithmeticCalculator,没有实例化的方法: package com.atguigu.spring.aop.impl.panpan; public in ...

  9. SPRING IN ACTION 第4版笔记-第七章Advanced Spring MVC-002- 在xml中引用Java配置文件,声明DispatcherServlet、ContextLoaderListener

    一.所有声明都用xml 1. <?xml version="1.0" encoding="UTF-8"?> <web-app version= ...

  10. Web.xml配置详解之context-param (加载spring的xml,然后初始化bean看的)

    http://www.cnblogs.com/goody9807/p/4227296.html(很不错啊) 容器先加载spring的xml,然后初始化bean时,会为bean赋值,包括里面的占位符

随机推荐

  1. [转]SQL 2005 开启OpenRowset/OpenDatasource的办法

    本文转自:http://www.cnblogs.com/chenghm2003/archive/2008/09/12/1289793.html 1.开始 —> 所有程序  —> Micro ...

  2. iOS:quartz2D绘图 (动画)

    quartz2D可以用来绘制自己需要的图形,它们绘制出来的是一个静态的图形,那么如何绘制一个动态的图形呢?动态的图形就是动画,所谓动画,其实就是很多张图片在短时间内不停的切换所产生的一种视觉效果.qu ...

  3. iOS:多线程NSThread的详细使用

    NSThread具体使用:直接继承NSObject NSThread:. 优点:NSThread 是轻量级的,使用简单 缺点:需要自己管理线程的生命周期.线程同步.线程同步对数据的加锁会有一定的系统开 ...

  4. 流畅的python第一章python数据模型学习记录

    python中有些特殊的方法,以双上下划线开头,并以双下划线结束的方法.如__getitem__,这些方法是特殊的方法,供python解释权内部使用,一般来说不需要调用 还有一种是以双下划线开头的,如 ...

  5. 关于typedef的用法总结(zz)

    不管实在C还是C++代码中,typedef这个词都不少见,当然出现频率较高的还是在C代码中.typedef与#define有些相似,但更多 的是不同,特别是在一些复杂的用法上,就完全不同了,看了网上一 ...

  6. java实现 tf-idf

    1.前言 TF-IDF(term frequency–inverse document frequency)是一种用于信息检索与数据挖掘的常用加权技术.TF意思是词频(Term Frequency), ...

  7. python 实现计算数独

    输入文件格式: 008309100900060004007504800036000540001000600042000970005907300600010008004608200 输出结果: yuan ...

  8. scala 2.11报错error: not found: type Application

    FROM: http://j-q-j.org/scala/scala-2-11-application-error.html 这两天学习scala,官网下载的最新版本2.11,书用的是<Prog ...

  9. java 图片文字识别 ocr

    最近在开发的时候需要识别图片中的一些文字,网上找了相关资料之后,发现google有一个离线的工具,以下为java使用的demo 在此之前,使用这个工具需要在本地安装OCR工具: 下面一个是一定要安装的 ...

  10. 能显示git分支的终端提示配置

    之前都是跟随潮流,安装zsh然后oh-my-zsh,选一个看起来顺眼的主题,一通瞎配置,很酷炫. 可是即使只有一个git插件,oh-my-zsh每次启动的时候都很慢,起码有好几秒,而且有时候zsh还会 ...