<?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. iOS:使用block进行类与类,控制器与控制器之间的传值

    介绍:在iOS中类与类,控制器与控制器之间传值的方式有多种,分别是:单例传值.代理传值.通知传值.block传值或者一些偏好设置也可以用来传值.... 每一种传值方式都有各自的优点和缺点,针对不同情况 ...

  2. http://blog.csdn.net/xingfuzhijianxia/article/details/6433918

    http://blog.csdn.net/xingfuzhijianxia/article/details/6433918

  3. [Functional Programming Monad] Substitute State Using Functions With A State Monad (get, evalWith)

    We take a closer look at the get construction helper and see how we can use it to lift a function th ...

  4. android不同机型上界面适配问题

    android中长度有:dp(或者dip device independent pixels)一种基于屏幕密度的抽象单位.在每英寸160点的显示器上.1dp=1px. 不同设备有不同的显示效果.这个和 ...

  5. 记一次MySQL找回用户数据

    事情经过 有天,我们公司外区的一个销售C说他8月3号以前的工作流记录找不到了.问清缘由,原来是更新了微信号(我们公司的工作流是基于企业微信开发的).经过分析,微信号和流程数据并没什么关系,所以初步得出 ...

  6. 【转】maven常见问题问答

    转自:http://www.iteye.com/topic/973166 前言 Maven,发音是[`meivin],"专家"的意思.它是一个很好的项目管理工具,很早就进入了我的必 ...

  7. Tomcat性能调整完整教程

    Tomcat性能调整完整教程 发表于:2007-07-13来源:作者:点击数:526 标签: 一. 引言 性能测试与分析是软件 开发 过程中介于架构和调整的一个广泛并比较不容易理解的领域,更是一项较为 ...

  8. react 执行 yarn build 后 去除 .js.map 文件

    map文件是帮助我们查看报错的位置的. map文件由devtool属性控制,如果不想要map,注释掉就可以,大约webpack.config.prod.js第57行: // devtool: shou ...

  9. PyPy与VirtualEnv的安装问题

    PyPy与VirtualEnv的安装问题 说明:本博客由bitpeach原创撰写,请勿商用.转载免费,请注明出处,谢谢. (零)背景 VirtualEnv工具的详细内容是什么,请自行百度.这里大概简介 ...

  10. 【PHP】(原创)之表单FORM的formhash校验,以TP3.2示例

    1.目的:每次表单POST提交(ajax的POST也适用)过来数据,都必须校验formhash参数是否和服务器端的一致,不一致说明重复提交或者 跨站攻击提交csrf 2.原理:参照了 KPPW 的fo ...