<?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:jee="http://www.springframework.org/schema/jee"
	xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
	xmlns:jpa="http://www.springframework.org/schema/data/jpa" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
	xmlns:util="http://www.springframework.org/schema/util"
	xmlns:repository="http://www.springframework.org/schema/data/repository"
	xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:aop="http://www.springframework.org/schema/aop"
	xsi:schemaLocation="
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
        http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
        http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd
        http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
        http://www.springframework.org/schema/data/repository http://www.springframework.org/schema/data/repository/spring-repository.xsd
        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd"
	default-lazy-init="true">

	<description>Spring公共配置 </description>
	<context:property-placeholder
		ignore-resource-not-found="true" location="classpath*:spring/application.properties" />
	<!-- 开启注解配置 -->
	<!-- 使用annotation 自动注册bean, 并保证@Required、@Autowired的属性被注入. @Controller的Bean注入在spring-mvc.xml中自动注册 -->
	<context:component-scan base-package="com.xt.hb.data" />
	<bean id="dataSource" class="com.xt.hb.data.system.DataSourceFactory"
		init-method="init" destroy-method="close">
		<property name="properties" value="classpath:/spring/dataSource.properties" />
		<property name="dsType" value="com.alibaba.druid.pool.DruidDataSource"></property>
	</bean>
	<bean id="dataSource-aq" class="com.xt.hb.data.system.DataSourceFactory"
		init-method="init" destroy-method="close">
		<property name="properties" value="classpath:/spring/dataSource-aq.properties" />
		<property name="dsType" value="com.alibaba.druid.pool.DruidDataSource"></property>
	</bean>
	<!-- ================== mybatis ==================================== -->
	<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
		<property name="dataSource" ref="dataSource" />
		<property name="mapperLocations" value="classpath:com/xt/hb/data/**/mapper/*.xml" />
		<!-- 配置Mybatis的插件plugin -->
		<property name="plugins">
			<array>
				<bean class="com.yuanxd.tools.pagehelper.PageHelper">
					<property name="properties">
						<value>
							dialect=oracle
						</value>
					</property>
				</bean>
			</array>
		</property>
	</bean>
	<bean id="sqlSessionFactory-aq" class="org.mybatis.spring.SqlSessionFactoryBean">
		<property name="dataSource" ref="dataSource-aq" />
		<property name="mapperLocations" value="classpath:com/xt/hb/data/**/aqmap/*.xml" />
		<!-- 配置Mybatis的插件plugin -->
		<property name="plugins">
			<array>
				<bean class="com.yuanxd.tools.pagehelper.PageHelper">
					<property name="properties">
						<value>
							dialect=oracle
						</value>
					</property>
				</bean>
			</array>
		</property>
	</bean>
	<!-- 配置扫描器 -->
	<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
		<!-- 扫描me.gacl.dao这个包以及它的子包下的所有映射接口类 -->
		<property name="basePackage" value="com.xt.hb.data.*.mapper" />
		<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
	</bean>
		<!-- 配置扫描器 -->
	<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
		<!-- 扫描me.gacl.dao这个包以及它的子包下的所有映射接口类 -->
		<property name="basePackage" value="com.xt.hb.data.*.aqmap" />
		<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory-aq" />
	</bean>
	<!-- ========================================事务配置========================================= -->
	<!-- 配置Spring的事务管理器 -->
	<bean id="transactionManager"
		class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
		<property name="dataSource" ref="dataSource" />
	</bean>
	<bean id="transactionManager-aq"
		class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
		<property name="dataSource" ref="dataSource-aq" />
	</bean>
	<aop:aspectj-autoproxy proxy-target-class="true" />
	<!-- 注解方式配置事物 -->
	<tx:annotation-driven transaction-manager="transactionManager-aq" />
	<tx:annotation-driven transaction-manager="transactionManager" />
	<!-- ========================================配置druid监控spring jdbc======================================== -->
	<bean id="druid-stat-interceptor"
		class="com.alibaba.druid.support.spring.stat.DruidStatInterceptor">
	</bean>
	<bean id="druid-stat-pointcut" class="org.springframework.aop.support.JdkRegexpMethodPointcut"
		scope="prototype">
		<property name="patterns">
			<list>
				<value>com.xt.hb.data.*</value>
			</list>
		</property>
	</bean>
	<aop:config>
		<aop:advisor advice-ref="druid-stat-interceptor"
			pointcut-ref="druid-stat-pointcut" />
	</aop:config>
	<!-- ======================================== 框架配置 ======================================== -->
	<!-- 框架ID标识生成器 -->
	<bean id="idGenerator" class="com.xt.hb.data.util.JdcIdGenerator" />
	<bean id="msaapiService" class="com.yuanxd.tools.hscbdt.HscbdtServiceFactory"
		factory-method="create" />
</beans>

