mybatis.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper   
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"   
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<configuration>
<settings>
        <!-- changes from the defaults for testing -->
        <setting name="cacheEnabled" value="false" />
        <setting name="useGeneratedKeys" value="true" />
        <setting name="defaultExecutorType" value="REUSE" />
    </settings>

<!--

如果MyBatis映射器XML文件在和映射器类相同的路径下不存在,那么另外一个需要配置文件的原因就是它了。
使用这个配置,有两种选择。第一是手动在MyBatis的XML配置文件中使用<mappers>部分来指定类路径。
第二是使用工厂bean的mapperLocations属性。
-->
    <mappers>
        <!--
        <mapper resource="classpath:com/mybatis/mapper/**/*.xml" />
         -->
        <mapper resource="classpath:com/mybatis/mapper/UserMapper.xml" />
    </mappers>

</configuration>

猜你喜欢

转载自wjacketcn.iteye.com/blog/1559557