今天在玩mybatis的时候,遇到这个奇葩问题。
最后发现,原因是 dtd文件配置错误了。错把Mapper的直接copy过来
把DOCTYPE mapper改成configuration,Mapper改成config即可
<?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> <typeAliases> <typeAlias alias="Jit" type="springmvcexample.demo.model.Jit"/> </typeAliases> <!-- 注册对象的空间命名 --> <environments default="development"> <environment id="development"> <transactionManager type="JDBC"/> <dataSource type="POOLED"> <property name="driver" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql://10.199.160.35:3306/vop_data_stg"/> <property name="username" value="root"/> <property name="password" value="test"/> </dataSource> </environment> </environments> <mappers> <mapper resource="jitMapper.xml" /> </mappers> </configuration>