spring-common.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: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的更多相关文章
- spring web.xml 难点配置总结
web.xml web.xml是所有web项目的根源,没有它,任何web项目都启动不了,所以有必要了解相关的配置. ContextLoderListener,ContextLoaderServlet, ...
- spring web.xml 难点配置总结【转】
web.xml web.xml是所有web项目的根源,没有它,任何web项目都启动不了,所以有必要了解相关的配置. ContextLoderListener,ContextLoaderServlet, ...
- spring applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.spr ...
- spring读取xml配置文件(二)
一.当spring解析完配置文件名的占位符后,就开始refresh容器 @Override public void refresh() throws BeansException, IllegalSt ...
- 这一次搞懂Spring的XML解析原理
前言 Spring已经是我们Java Web开发必不可少的一个框架,其大大简化了我们的开发,提高了开发者的效率.同时,其源码对于开发者来说也是宝藏,从中我们可以学习到非常优秀的设计思想以及优雅的命名规 ...
- [Java] 解决spring的xml标签内不能自由增加说明的难题,方便调试、部署时进行批量屏蔽
作者:zyl910 以往我们想在spring的xml配置文件中增加说明文本时,只能使用xml注释(<!-- 注释 -->).这对于"调试.部署时想批量屏蔽部分bean" ...
- Spring 通过XML配置文件以及通过注解形式来AOP 来实现前置,环绕,异常通知,返回后通知,后通知
本节主要内容: 一.Spring 通过XML配置文件形式来AOP 来实现前置,环绕,异常通知 1. Spring AOP 前置通知 XML配置使用案例 2. Spring AOP ...
- Spring AOP:面向切面编程,AspectJ,是基于spring 的xml文件的方法
导包等不在赘述: 建立一个接口:ArithmeticCalculator,没有实例化的方法: package com.atguigu.spring.aop.impl.panpan; public in ...
- SPRING IN ACTION 第4版笔记-第七章Advanced Spring MVC-002- 在xml中引用Java配置文件,声明DispatcherServlet、ContextLoaderListener
一.所有声明都用xml 1. <?xml version="1.0" encoding="UTF-8"?> <web-app version= ...
- Web.xml配置详解之context-param (加载spring的xml,然后初始化bean看的)
http://www.cnblogs.com/goody9807/p/4227296.html(很不错啊) 容器先加载spring的xml,然后初始化bean时,会为bean赋值,包括里面的占位符
随机推荐
- iOS:CALayer核心动画层
CALayer:核心动画层 简介: Core Animation 是跨平台的,支持iOS环境和Mac OS X环境 学习核心动画之前,需要先理解CALayer,因为核心动画操作的对象不是UIView, ...
- Linux驱动mmap内存映射
mmap在linux哪里? 什么是mmap? 上图说了,mmap是操作这些设备的一种方法,所谓操作设备,比如IO端口(点亮一个LED).LCD控制器.磁盘控制器,实际上就是往设备的物理地址读写数据. ...
- (转)Android技术积累:图片异步加载
当在ListView或GridView中要加载很多图片时,很容易出现滑动时的卡顿现象,以及出现OOM导致FC(Force Close). 会出现卡顿现象主要是因为加载数据慢,要等数据加载完才能显示出来 ...
- 【Python】装饰器实现日志记录
好的日志对一个软件的重要性是显而易见的.如果函数的入口都要写一行代码来记录日志,这种方式实在是太低效了,但一直没有找到更好的方法.后来用python写一些软件,了解到python的装饰器功能时,突然人 ...
- python读取中文
如何从文件中读取300个汉字? 看起来很简单,但很容易掉坑里了. 一开始我这么写: try: fd = codecs.open(os.path.join(settings.TEXT_CONTENT_D ...
- WindowProc和DefWindowProc的差别
1. WindowProc是你给自己的窗体定义的窗体处理函数 DefWindowProc是windows平台提供的默认窗体处理函数 假设某些消息你不须要做特别的处理,调用DefWindowProc进行 ...
- 在笛卡尔坐标系上描绘函数2*x+Math.sqrt(5-x*x)及其共轭函数2*x-Math.sqrt(5-x*x)曲线
代码如下: <!DOCTYPE html> <html lang="utf-8"> <meta http-equiv="Content-Ty ...
- SQLServer:探讨EXEC与sp_executesql的区别详解
摘要 MSSQL为我们提供了两种动态执行SQL语句的命令,分别是EXEC和sp_executesql;通常,sp_executesql则更具有优势,它提供了输入输出接口,而EXEC没有.还有一个最大的 ...
- vue - for 遍历对象和遍历对象数组
1. 遍历对象时,参数: 第一个为值,第二个为键名,第三个为索引 <!DOCTYPE html> <html lang="en"> <head> ...
- JavaScript | JQuery插件定义方法
参考 http://www.2cto.com/kf/201507/417874.html ——————————————————————————————————————————————————————— ...