SSM_OA_MYbatis配置

来源:互联网 发布:专业足球数据网站 编辑:程序博客网 时间:2024/06/08 20:01
<?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:p="http://www.springframework.org/schema/p"    xmlns:context="http://www.springframework.org/schema/context"    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"    xsi:schemaLocation="http://www.springframework.org/schema/beans         http://www.springframework.org/schema/beans/spring-beans-4.0.xsd         http://www.springframework.org/schema/context         http://www.springframework.org/schema/context/spring-context-4.0.xsd         http://www.springframework.org/schema/aop         http://www.springframework.org/schema/aop/spring-aop-4.0.xsd         http://www.springframework.org/schema/tx         http://www.springframework.org/schema/tx/spring-tx-4.0.xsd ">    <!-- 引入数据源配置文件 -->    <import resource="./application-datasource.xml" />    <!-- MyBatis配置 -->    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">        <property name="dataSource" ref="dataSource" />        <!-- 配置扫描model包路径 -->        <property name="typeAliasesPackage" value="com.qsy.application.model" />        <!-- 配置扫描Mapper XML的位置 -->        <property name="mapperLocations"            value="classpath*:com/qsy/application/mapping/*.xml" />        <!-- 对应configuration的settings配置 -->        <property name="configurationProperties">            <props>                <prop key="logImpl">LOG4J</prop>            </props>        </property>    </bean>    <!-- 配置扫描Mapper接口的包路径 -->    <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">        <!-- 指定Mapper接口文件所在的基包 -->        <property name="basePackage" value="com.qsy.application.dao" />        <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />    </bean></beans>
原创粉丝点击