The content of element type "configuration" must match "(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?,objectWrapperFactory?,reflectorFactory?,plugins?,environments?,databaseIdProv
在mybatis配置文件config.xml中报错:
The content of element type "configuration" must match
"(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?,objectWrapperFactory?,reflectorFactory?,plugins?,environments?,databaseIdProvider?,mappers?)".
是因为配置信息的顺序放置错误,应遵循:
元素类型“配置”的内容必须匹配
“(属性?,设置?,typealiases?,typehandlers?、化?,objectwrapperfactory?,reflectorfactory?,插件吗?,环境?,databaseidprovider?,映射?)”。
示例代码
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://www.mybatis.org/dtd/mybatis-3-config.dtd">
<!--configuration根标签-->
<configuration> <!-- 二、(1) 定义实体bean名和数据库列名相对应 type:实体的路径 alias:实体的别名 -->
<typeAliases>
<typeAlias type="com.ckx.entity.User" alias="User" />
</typeAliases> <!--二、 (2) 引入关系映射文件!!!这里有严格顺序!不能放在数据源配置前-->
<mappers>
<mapper resource="com.ckx.entityMapper.UserMapper.xml" />
</mappers> <!--一、 配置环境信息-->
<environments default="admin">
<environment id="admin">
<!-- 指定事务管理机制-->
<transactionManager type="JDBC"></transactionManager>
<!-- 配置数据源 POOLED: 连接池-->
<dataSource type="POOLED">
<property name="driver" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/ceshi?useUnicode=true&characterEncoding=utf8" />
<property name="username" value="root" />
<property name="password" value="123456" />
</dataSource>
</environment>
</environments> </configuration>
改变顺序即可消除错误:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://www.mybatis.org/dtd/mybatis-3-config.dtd">
<!--configuration根标签-->
<configuration> <!-- 二、(1) 定义实体bean名和数据库列名相对应 type:实体的路径 alias:实体的别名 -->
<typeAliases>
<typeAlias type="com.ckx.entity.User" alias="User" />
</typeAliases> <!--一、 配置环境信息-->
<environments default="admin">
<environment id="admin">
<!-- 指定事务管理机制-->
<transactionManager type="JDBC"></transactionManager>
<!-- 配置数据源 POOLED: 连接池-->
<dataSource type="POOLED">
<property name="driver" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/ceshi?useUnicode=true&characterEncoding=utf8" />
<property name="username" value="root" />
<property name="password" value="123456" />
</dataSource>
</environment>
</environments> <!--二、 (2) 引入关系映射文件!!!这里有严格顺序!不能放在数据源配置前-->
<mappers>
<mapper resource="com.ckx.entityMapper.UserMapper.xml" />
</mappers> </configuration>
The content of element type "configuration" must match "(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?,objectWrapperFactory?,reflectorFactory?,plugins?,environments?,databaseIdProv的更多相关文章
- The content of element type "configuration" must match "(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?...
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE configuration PUBLIC & ...
- 【转】The content of element type "configuration" must match "(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?...
[转]The content of element type "configuration" must match "(properties?,settings?,typ ...
- mybatis配置文件,注意标签配置顺序。否则报错The content of element type "configuration" must match "(properties?,settings?,...怎么解决
感谢原作者http://www.cnblogs.com/zhoumingming/p/5417014.html 注意每个标签必须按照顺序写,不然就会提示错误 顺序是 <?xml version= ...
- 元素类型为 "configuration" 的内容必须匹配 "(properties?,settings?,typeAliases?,typeHandlers?
报错主要部分如下: Error building SqlSession.### Cause: org.apache.ibatis.builder.BuilderException: Error cre ...
- Multiple annotations found at this line: - The content of element type "mapper" must match "EMPTY". - Attribute "namespace" must be declared for element type "mapper".
今天在mybatis的mapper映射配置文件中遇到了这样的问题,困扰了我3个小时: Multiple annotations found at this line: - The content of ...
- The content of element type "package" must match "(result-types?,interceptors?...
错误:“The content of element type "package" must match "(result-types?,interceptors?,de ...
- web.xml配置bug之提示The content of element type "web-app" must match "(icon?,display- name?,description?,distributable?,
错误:配置web.xml时,出现红色叉叉,提示 The content of element type "web-app" must match "(icon?,disp ...
- The content of element type "beans" must match "(description?,(import|alias|bean)*)
The content of element type "beans" must match "(description?,(import|alias|bean)*) - ...
- The content of element type "package" must match "(result-types?,interceptors?,default-interceptor-ref?,default-action-ref?,default-class-ref?,global- results?,global-exception-mappings?,action*)".
报错 The content of element type "package" must match "(result-types?,interceptors?,def ...
随机推荐
- 关于清除丢失贴图与IES文件
fn YY_clrmessingmaps = ( YY_messingmap = #() allBitmaps = getClassInstances BitmapTexture -- 所有材质 to ...
- DNA排序
Q:DNA排序 总时间限制:1000ms内存限制:65536kB 描述 给出一系列基因序列,由A,C,G,T四种字符组成.对于每一个序列,定义其逆序对如下: 序列中任意一对字符X和Y,若Y在X的右边( ...
- asp.net Routing 用法
http://www.cnblogs.com/youring2/archive/2011/07/22/2113595.html asp.net 4.0中提供了Routing 的支持.通过使用routi ...
- C#中的async和await
其实这两个关键字的功效比之前的异步方法调用有一个好处,那就是异步阻塞的方法可以有返回值.之前都是通过回调函数实现,执行上下文会切换,不过和这个执行过程类似.可以对这两个关键字这么理解:遇到async的 ...
- Anchor 对象
更改一个链接的文本.URL 以及target<html><head><script type="text/javascript"> functi ...
- Spring使用环境变量控制配置文件加载
项目中需要用到很多配置文件,不同环境的配置文件是不一样的,因此如果只用一个配置文件,势必会造成配置文件混乱,这里提供一种利用环境变量控制配置文件加载的方法,如下: 一.配置环境变量 如果是window ...
- Struts2实现简单的在线人数统计
用Strust2框架的知识简单实现一个统计在线人数的问题. 1 搭建开发环境:(配置文件,jar包等问题) 2 index.jsp <%@ page language="java&qu ...
- 使用 Windows AIK 创建自定的客户端系统WIM文件
Windows 7/2008 的AIK 3.0下载页面:地址链接 1.8G [3.1补充包为1.4G] 安装3.0后,升级为3.1方法: xcopy E:\ "C:\Program File ...
- java Util
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.qihangedu.tms.a ...
- java 线程的使用
java 线程的使用 //线程的使用 //需要记三个单词 //1.Thread 线程的类名 //2. Runnable 线程的接口 //3. start 执行线程 //使用继承线程类的方式实现线程 c ...