<beans xmlns="http://www.springframework.org/schema/beans"
	   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	   xmlns:util="http://www.springframework.org/schema/util"
	   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.xsd
         http://www.springframework.org/schema/context
            http://www.springframework.org/schema/context/spring-context-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.xsd
http://www.springframework.org/schema/util  http://www.springframework.org/schema/util/spring-util-3.1.xsd">

	<context:component-scan base-package="com.ag"/>
<!--	<aop:aspectj-autoproxy/>  &lt;!&ndash; 要添加本行 &ndash;&gt;-->
	<import resource="classpath*:/applicationContext-mapper.xml" />
	<bean id="fodataBaseSource" class="com.ag.config.BaseDataSourceCfg"/>

	<bean id="mybatisConfig" class="com.baomidou.mybatisplus.core.MybatisConfiguration">
		<property name="mapUnderscoreToCamelCase" value="true"/>
		<property name="logImpl" value="org.apache.ibatis.logging.stdout.StdOutImpl"/>
		<!-- 部分数据库不识别默认的NULL类型（比如oracle，需要配置该属性 -->
		<property name="jdbcTypeForNull">
			<util:constant static-field="org.apache.ibatis.type.JdbcType.NULL"/>
		</property>
	</bean>

	<bean id="sqlSessionFactory" class="com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean">
		<property name="dataSource" ref="fodataBaseSource"/>
		<property name="configuration" ref="mybatisConfig"/> <!--  非必须  -->
		<property name="mapperLocations">
			<list>
				<value>classpath*:mapper/*.xml</value>
				<value>classpath:platform/*/*Mapper.xml</value>
				<value>classpath:basecode/*Mapper.xml</value>
				<value>classpath:ctariff/*Mapper.xml</value>
			</list>

		</property>
		<property name="plugins">
			<array>
				<bean  class="com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor">
					<property name="interceptors">
						<array>
							<bean class="com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor">
								<constructor-arg type="com.baomidou.mybatisplus.annotation.DbType" value="MYSQL"/>
							</bean>
						</array>
					</property>
				</bean>
			</array>
		</property>
	</bean>
	<bean id="sqlSessionTemplate"  class="org.mybatis.spring.SqlSessionTemplate">
		<constructor-arg index="0" ref="sqlSessionFactory" />
	</bean>
	<!-- 事务管理器 -->
	<bean id="txManagerFo"
		  class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
		<property name="dataSource" ref="fodataBaseSource" />

	</bean>
	<!-- 事务注解驱动，标注@Transactional的类和方法将具有事务性 -->
	<tx:annotation-driven transaction-manager="txManagerFo"  proxy-target-class="true" />

	<bean id="jdbcTemplatebusiness"
		  class="org.springframework.jdbc.core.JdbcTemplate" lazy-init="false">
		<property name="dataSource" ref="fodataBaseSource"/>
	</bean>


</beans>