MyBatis configuration file, note the label configuration order. Otherwise error the content of element type "configuration" must match "(Properties?,settings?,... How to Solve

Source: Internet
Author: User

Thank the original author http://www.cnblogs.com/zhoumingming/p/5417014.html

Note that each label must be written in order, or it will prompt an error

Order is

<?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" >
<configuration>

<!--load Properties file--
<properties resource= "Db.properties" >
<!--properties You can also configure some property names and property values-
<!--<property name= "jdbc.driver" value= ""/>-
</properties>


<!--global configuration parameters, when needed and set-

<settings>
<!--Open the delay-loaded switch--
<setting name= "lazyloadingenabled" value= "true"/>
<!--to change active load to negative load that loads as needed
<setting name= "aggressivelazyloading" value= "false"/>
<!--turn on level two cache--
<setting name= "cacheenabled" value= "true"/>
</settings>

<!--alias Definition--
<typeAliases>

<!--defined for a single alias
Type: The path of the types
Alias: Aliases
-
<!--<typealias type= "Cn.itcast.mybatis.po.User" alias= "User"/>-
<!--batch alias definition
Specifies the package name, MyBatis automatically scans the PO class in the package, and automatically defines the alias, which is the class name (either uppercase or lowercase)
-
<package name= "Cn.itcast.mybatis.po"/>

</typeAliases>

<!--and spring are integrated after the environments configuration will be abolished--
<environments default= "Development" >
<environment id= "Development" >
<!--using JDBC Transaction management, transaction control by mybatis-->
<transactionmanager type= "JDBC"/>
<!--database connection pool, managed by MyBatis
<datasource type= "Pooled" >
<property name= "Driver" value= "${jdbc.driver}"/>
<property name= "url" value= "${jdbc.url}"/>
<property name= "username" value= "${jdbc.username}"/>
<property name= "Password" value= "${jdbc.password}"/>
</dataSource>
</environment>
</environments>
<!--load a mapping file--
<mappers>
<mapper resource= "Sqlmap/user.xml"/>

<!--load one mapping file at a time with the resource method--
<!--<mapper resource= "Mapper/usermapper.xml"/>--

<!--loading a single mapping file via the Mapper interface
Follow some specifications: You need to keep the Mapper interface class name and the Mapper.xml mapping file name consistent and in one directory
The prerequisite for the above specification is that the Mapper proxy method is used
-
<!--<mapper class= "Cn.itcast.mybatis.mapper.UserMapper"/>--

<!--bulk Load Mapper
Specifies the package name of the Mapper interface, MyBatis automatically scans all mapper interfaces underneath the package for loading
Follow some specifications: You need to keep the Mapper interface class name and the Mapper.xml mapping file name consistent and in one directory
The prerequisite for the above specification is that the Mapper proxy method is used
-
<package name= "Cn.itcast.mybatis.mapper"/>

</mappers>

</configuration>

That's roughly the order.

MyBatis configuration file, note the label configuration order. Otherwise error the content of element type "configuration" must match "(Properties?,settings?,... How to Solve

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.