在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&amp;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&amp;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的更多相关文章

  1. The content of element type "configuration" must match "(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?...

    <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE configuration PUBLIC & ...

  2. 【转】The content of element type "configuration" must match "(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?...

    [转]The content of element type "configuration" must match "(properties?,settings?,typ ...

  3. mybatis配置文件,注意标签配置顺序。否则报错The content of element type "configuration" must match "(properties?,settings?,...怎么解决

    感谢原作者http://www.cnblogs.com/zhoumingming/p/5417014.html 注意每个标签必须按照顺序写,不然就会提示错误 顺序是 <?xml version= ...

  4. 元素类型为 "configuration" 的内容必须匹配 "(properties?,settings?,typeAliases?,typeHandlers?

    报错主要部分如下: Error building SqlSession.### Cause: org.apache.ibatis.builder.BuilderException: Error cre ...

  5. 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 ...

  6. The content of element type "package" must match "(result-types?,interceptors?...

    错误:“The content of element type "package" must match "(result-types?,interceptors?,de ...

  7. 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 ...

  8. The content of element type "beans" must match "(description?,(import|alias|bean)*)

    The content of element type "beans" must match "(description?,(import|alias|bean)*) - ...

  9. 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 ...

随机推荐

  1. Qt 自定义 滚动条 样式

    今天是时候把软件中的进度条给美化美化了,最初的想法就是仿照QQ. 先前的进度条是这样,默认的总是很难受欢迎的:美化之后的是这样,怎么样?稍微好看一点点了吧,最后告诉你实现这个简单的效果在Qt只需要加几 ...

  2. 20151214下拉列表:DropDownList

    注意: .如果用事件的话就要把控件的AutoPostBack设置成true .防止网页刷新用一个判断 if (!IsPostBack)//判断是第一个开始还是取的返回值 { } 下拉列表:DropDo ...

  3. ABBYY有哪些图像处理选项

    ABBYY PDF Transformer+ 这款Ocr图文识别软件提供多种图像处理选项,可提高源图像的质量,便于准确地识别光学字符.我们扫描纸质文档或从图像文件创建 PDF 时,务必选择合适的图像处 ...

  4. Downloader调用WCF服务返回文件

    Generator using System; using System.Collections.Generic; using System.IO; namespace Downloader { pu ...

  5. mac10.9下eclipse的storm开发环境搭建

    --------------------------------------- 博文作者:迦壹 博客地址:http://idoall.org/home.php?mod=space&uid=1& ...

  6. knockout 学习实例4 css

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  7. LINQ查询操作符之Select、Where、OrderBy、OrderByDescending、GroupBy、Join、GroupJoin及其对应的查询语法

    介绍    ·Select - Select选择:延迟    ·Where - Where查询:延迟    ·OrderBy - 按指定表达式对集合正序排序:延迟    ·OrderByDescend ...

  8. Spring-MVC开发之全局异常捕获全面解读

    异常,异常 我们一定要捕获一切该死的异常,宁可错杀一千也不能放过一个! 产品上线后的异常更要命,一定要屏蔽错误内容,以免暴露敏感信息! 在用Spring MVC开发WEB应用时捕获全局异常的方法基本有 ...

  9. ruby的加密方法整理(des rsa加密 加签)

    # coding:utf-8require 'openssl'require 'base64'#des加密并且base64编码def des_encrypt des_key, des_text des ...

  10. div 居中

    Found another solution: Just add position: relative; top: 50%; transform: translateY(-50%); to the i ...