mybatis of dtd xml constraint files and configuration files automatically prompts



# Mybatis of dtd constraint file download

(1) mybatis-3-config.dtd constraint file download:

http://mybatis.org/dtd/mybatis-3-config.dtd

(2) mybatis-3-mapper.dtd constraint file download:

http://mybatis.org/dtd/mybatis-3-mapper.dtd

# Eclipse configuration

Here Insert Picture Description

Here Insert Picture Description

# config

<?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>
	<environments default="development">
		<environment id="development">
			<!--使用jdbc事务管理 -->
			<transactionManager type="JDBC"/>
			<!-- 数据库连接池 -->
			<dataSource type="POOLED">
				<property name="driver" value="com.mysql.jdbc.Driver"/>
				<property name="url" value="jdbc:mysql://localhost:3306/mybatis?characterEncoding=utf-8"/>
				<property name="username" value="root"/>
				<property name="password" value="1234"/>
			</dataSource>
		</environment>
	</environments>
	<!-- 引入映射配置文件 -->
	<mappers>
		<mapper resource="cn/zhku/jsj/mybatis/pojo/User.xml"/>
	</mappers>
</configuration>

# mapper

<?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">
 
<!-- namespace:命名空间,用于隔离sql-->
<mapper namespace="user">
	<select id="findUserByUsername" parameterType="String" resultType="cn.zhku.jsj.mybatis.pojo.User">
		select * from user where username like '%${value}%'
	</select>
</mapper>
Published 296 original articles · won praise 61 · views 7110

Guess you like

Origin blog.csdn.net/LawssssCat/article/details/103960249