<?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:context="http://www.springframework.org/schema/context"
|
xmlns:tx="http://www.springframework.org/schema/tx"
|
xmlns:aop="http://www.springframework.org/schema/aop"
|
xmlns:cache="http://www.springframework.org/schema/cache"
|
xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
|
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-4.0.xsd
|
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
|
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd">
|
|
<!-- 扫描组件Bean对象:排除handler组件,剩余都进行管理 -->
|
<context:component-scan base-package="cn.com.basic.face.discern">
|
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
|
</context:component-scan>
|
|
<!-- 加载外部属性配置文件 -->
|
<context:property-placeholder location="classpath:jdbc.properties"/>
|
|
<!-- 配置C3P0数据源 -->
|
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" abstract="true">
|
<property name="driverClass" value="${jdbc.driver}"/>
|
<property name="user" value="${jdbc.user}"/>
|
<property name="password" value="${jdbc.password}"/>
|
<property name="jdbcUrl" value="${jdbc.url}"/>
|
</bean>
|
|
<!-- 配置SQLSessionFactory -->
|
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
|
<!-- ①装配数据源 -->
|
<property name="dataSource" ref="dataSource"/>
|
<!-- ②指定MyBatis自身配置文件的位置 -->
|
<property name="configLocation" value="classpath:MyBaits-config.xml"/>
|
<!-- typeAliasesPackage属性value值:可以指定父包,自动扫描子包 -->
|
<!-- ③指定实体类的位置 -->
|
<property name="typeAliasesPackage" value="cn.com.basic.face.discern"/>
|
<!-- <property name="mapperLocations"></property> -->
|
</bean>
|
|
<!-- 扫描Mapper映射配置 -->
|
<bean id="mapperScannerConfigurer" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
|
<property name="basePackage" value="cn.com.basic.face.discern.baseapi"/>
|
</bean>
|
|
|
|
</beans>
|