The content of element type configuration must match (properties?,settings?,typeAliases?,typeHand...
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-config.dtd">
- <!-- 注意:每个标签必须按顺序写,不然蛋疼的DTD会提示错误:The content of element type "configuration" must match "(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?,objectWrapperFactory?,plugins?,environments?,mappers?)". -->
- <configuration>
- <!-- 属性配置 -->
- <properties resource="com/mybatisdemo/config/mysql-jdbc-connection.properties">
- <!-- 相同属性:最高优先级的属性是那些作为方法参数的,然后是资源/url 属性,最后是 properties元素中指定的属性 -->
- <property name="username" value="root"/>
- <property name="password" value="sa"/>
- </properties>
- <!-- 设置缓存和延迟加载等等重要的运行时的行为方式 -->
- <settings>
- <!-- 设置超时时间,它决定驱动等待一个数据库响应的时间 -->
- <setting name="defaultStatementTimeout" value="25000"/>
- </settings>
- <!-- 别名 -->
- <typeAliases>
- <typeAlias alias="UserInfo" type="com.mybatisdemo.entity.UserInfo"/>
- </typeAliases>
- <environments default="development">
- <!-- environment 元素体中包含对事务管理和连接池的环境配置 -->
- <environment id="development">
- <transactionManager type="JDBC" />
- <!-- type分三种:
- UNPOOLED是每次被请求时简单打开和关闭连接
- UNPOOLED的数据源仅仅用来配置以下 4 种属性driver,url,username,password
- POOLED :JDBC连接对象的数据源连接池的实现,不直接支持第三方数据库连接池
- -->
- <dataSource type="POOLED">
- <property name="driver" value="${driver}" />
- <property name="url" value="${url}" />
- <property name="username" value="${username}" />
- <property name="password" value="${password}" />
- </dataSource>
- </environment>
- </environments>
- <!-- ORM映射文件 -->
- <mappers>
- <mapper resource="com/mybatisdemo/entity/config/UserInfoSqlMap.xml" />
- </mappers>
- </configuration>
注意:
①xml中的标签顺序不能随便调换,否则会提示错误
②MyBatis使用自带的数据库连接池,不直接支持第三方连接池,不过网上有创建第三方连接池的方法
③以前别名(<typeAliases>)可以在sqlMap标签中创建,但现在需要在configuration标签中创建
④该配置文件可随意取名,在读取配置文件时指定该XML文件路径即可:
- //读取核心配置文件
- Reader reader = Resources.getResourceAsReader("com/mybatisdemo/config/Configuration.xml");
- //创建SessionFactory实例
- SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
转载于:https://www.cnblogs.com/telwanggs/p/5458239.html
The content of element type configuration must match (properties?,settings?,typeAliases?,typeHand...相关推荐
- The content of element type configuration must match (properties?,setting
在运行mybatis配置文件的时候,出现错误: [html] view plain copy Caused by: org.xml.sax.SAXParseException: The conte ...
- 在xml文件中使用typeAliases标签报错The content of element type “configuration“ must match “(properties?,setting
typeAliases标签:为Java 类型设置一个短的名字/别名 这里的错误提示:(properties?,settings?,typeAliases?,typeHandlers?,objectFa ...
- mybatis:configuration must match (properties?,settings?,typeAliase.....
在运行mybatis配置文件的时候,出现错误: Caused by: org.xml.sax.SAXParseException: The content of element type " ...
- mybatis项目启动报错 The content of element type resultMap must match (constructor?,id*,result*,associat...
启动项目报错 2018-02-26 17:09:51,535 ERROR [org.springframework.web.context.ContextLoader] - Context initi ...
- namespace 或The content of element type mapper must match EMPTY
必须为元素类型 "mapper" 声明属性 "namespace" 或The content of element type "mapper" ...
- The content of element type web-app must match……等 问题之解决办法
在flex整合Java生成的web.xml中添加引用servelet的代码就报错如下: The content of element type "web-app" must mat ...
- The content of element type “mapper“ must match “EMPTY“.错误
<mappers><mapper resource="cn/java/dao/impl/xxx.xml"></mapper></mappe ...
- java项目问题 The content of element type servlet must match (icon?,servlet-name,display-name?,descrip
错误问题:The content of element type "servlet" must match "(icon?,servlet-name,display-na ...
- arse Error at line 58 column 17: The content of element type struts-config must match (display-na
以前没有接触过struts1的项目 刚上来开发公司来的项目的时候遇到的这个错误. 报错信息: 严重: Parse Error at line 58 column 17: The content of ...
最新文章
- android4.3.0 camera,4.3、高通camera驱动简析
- jmeter负载测试测试_使用Apache JMeter负载测试Web应用程序
- 漫步数学分析三十五——乘法法则与梯度
- check GPU mem size on condor
- TXSQL:云计算时代数据库核弹头——云+未来峰会开发者专场回顾
- Oracle前10条记录
- 升腾主机装linux,升腾终端安装说明
- 精品软件 推荐 常用软件 游戏的 运行库 下载 合集 3D game 玩游戏的一定要收藏一下。...
- 目前计算机硬件安全,计算机硬件与网络安全
- [源码和文档分享]基于VC++实现的中国象棋-双人象棋游戏
- 双光子成像和近红外二区荧光共聚焦成像/树状大分子CT/MRI双模态成像造影剂/锰螯合物磁共振成像(MRI)
- linux中硬链接为什么不能跨分区
- unity ToggleGroup和Toggle.isOn的坑
- tiny4412开发板Android篇_3基于tiny4412的Android系统的烧写(SD卡烧写到emmc)
- UnityShader(三)基础多光照+遮罩Shader
- java基础(个人笔记)
- matlab中axis函数程序,matlab中axis函数
- JAVA动态网页开发:框架
- python制作二维码_基于Python生成个性二维码过程详解
- day inset_SetIP三星网络打印IP设置软件
热门文章
- gsp 页面 html.dat,grails2.3.x在gsp显示html
- FPGA RTL级设计原则
- (2)verilog语言编写打两拍
- html5多颜色灯笼旋转,HTML5 Canvas 漂亮的斑马条纹灯笼
- python类2继承-抽象-多态
- mysql 利用触发器(Trigger)让代码更简单
- linux 复用寄存器,I/O多路复用一些概念
- JavaScript重难点解析1(数据类型——var、let、const区别,类型补充,“===”、“typeof”、“instanceof”区别,Symbol数据类型)
- python函数的嵌套和递归_Python通过递归函数输出嵌套列表元素
- 贝叶斯网络+推理+近似推理+变分法