<?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. phpstorm不安装apache就可以本地测试PHP

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

  2. shadow mapping实现动态shadow实现记录 【转】

    http://blog.csdn.net/iaccepted/article/details/45826539 前段时间一直在弄一个室内场景,首先完成了render,效果还可以.然后给其加上shado ...

  3. 深入理解JavaScript模拟私有成员

    一般的面向对象语言C++或JAVA,对象都是有私有成员的.js中没有类的改变,同样也没有对象的私有成员这个概念.但是可以通过某些特殊写法,模拟出私有成员. 1.特权模式: (1)在构造函数内部声明的变 ...

  4. IntelliJ IDEA java开发 WebService

    测试的功能是通过访问solr服务器,获取相关信息,然后以webservice的形式供客户端访问来获取数据.通过查询资料,现在把过程记录如下: 1.环境 IntelliJ IDEA 2017.2.6 J ...

  5. DevExpress TreeList使用

    using System; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; us ...

  6. 前端性能优化:DocumentFragments或innerHTML取代复杂的元素注入

    来源:GBin1.com 我们的浏览器执行越来越多的特性,并且网络逐渐向移动设备转移,使我们的前端代码更加紧凑,如何优化,就变得越来越重要了.前端给力的地方是可以有 许多种简单的策略和代码习惯让我们可 ...

  7. C#秘密武器之特性

    一.概述 Attribute说白了就是一个类而已,里边一般含有一些附加信息,或者一些特殊的处理逻辑,以便告诉编译器应用该特性的东东是个奇葩,需要特殊对待! 二.使用时的注意事项 2.1. Attrib ...

  8. python 静态成员变量

    python 静态成员变量 python 也可以定义静态成员变量,就是类的变量. 注意python的静态成员变量只能通过 类.变量名 的形式获取 class A: a1 = 0 def __init_ ...

  9. maven编译war包,pom中必须有的几个dependency

    <!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api --> <dependency> ...

  10. struts 页面调用Action的指定方法并传递参数

    如果为action配置了类,那么默认就会执行Action类的excute方法,Action类的写法三种: ① public class Action1 { public String execute( ...