<?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. linux自定义开机启动服务和chkconfig使用方法

    linux自定义开机启动服务和chkconfig使用方法 1. 服务概述在linux操作系统下,经常需要创建一些服务,这些服务被做成shell脚本,这些服务需要在系统启动的时候自动启动,关闭的时候自动 ...

  2. phpstorm不安装apache就可以本地测试PHP

    最近再搞个PHP的项目,找了很多发现phpstorm这个非常小巧而且很好用,,顺便推荐一下idea开发android非常不错,这2个IDE都是一家公司的.本文由智动软件(zdexe.com)原创,转载 ...

  3. [GLSL]着色器周记02——火焰特效 【转】

    http://www.cnblogs.com/tkgamegroup/p/4214081.html 这周学了好多.包括伪随机数.柏林噪声.先说伪随机数.伪随机数我们用的是周期函数而不是那种由前一项乘一 ...

  4. 【云计算】OpenStack Horizon DashBoard定制化,完整实现前后台交互

    项目代码见GitHub:https://github.com/junneyang/openstack-customization-example 参考资料: Install and configure ...

  5. Netty利用ChannelGroup广播消息

    在Netty中提供了ChannelGroup接口,该接口继承Set接口,因此可以通过ChannelGroup可管理服务器端所有的连接的Channel,然后对所有的连接Channel广播消息. Serv ...

  6. dubbo-monitor安装监控中心,管理控制台安装

    一.安装监控中心 1.创建安装目录 2.解压 上传文件解压文件 解压 3.修改配置文件 4.启动 如果一直出现点.只需要加大内存即可,内存至少大于1024,然后reboot重启 5.测试 二.安装管理 ...

  7. RandomForest&ROC

    # -*- coding: utf-8 -*- # __author__ = 'JieYao' from biocluster.agent import Agent from biocluster.t ...

  8. 【转帖】Servlet 3.0 新特性详解

    http://www.ibm.com/developerworks/cn/java/j-lo-servlet30/ Servlet 3.0 新特性概述 Servlet 3.0 作为 Java EE 6 ...

  9. 两周赚100万 在Google Play做对了什么

    http://tech.it168.com/a2013/0301/1457/000001457913_all.shtml

  10. JBoss类隔离

    http://tiger888.iteye.com/blog/572875这几天,项目组在部署JBOSS时遇到不少问题,都是由于JBOSS的类装载问题引起,特发表一篇BLOG详细说一下JBOSS的类隔 ...