1创建一个简单的java项目\
2导入jar包
建立一个lib包
链接:https://pan.baidu.com/s/1eJ7xXF2qvUbgde2T--Sphg
提取码:3bgy
加入junit的包 右键项目---build path---add library
4导入配置文件
log4j.properties
### 设置###
log4j.rootLogger = ERROR,stdout
### è¾åºä¿¡æ¯å°æ§å¶æ¬ ###
log4j.appender.stdout = org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern = [%-5p] %d{yyyy-MM-dd HH:mm:ss,SSS} method:%l%n%m%n
log4j.category.org.springframework.beans.factory=ERROR
db.properties
jdbc.driver=com.oracle.jdbc.OracleDriver
jdbc.url=jdbc:oracle:thin:@127.0.0.1:1521:wiicare
jdbc.username=wiicare
jdbc.password=Mdsd123
mybatis-config.xml
<?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">
<configutation>
<!-- 引入数据库配置 -->
<properties resource="db.properties"></properties>
<!-- 定义数据源 -->
<environments default="">
<environment id="development">
<dataSource type="POOLED">
<property name="driver" value="${jdbc.driver}"></property>
<property name="url" value="${jdbc.url}"></property>
<property name="username" value="${jdbc.username}"></property>
<property name="password" value="${jdbc.password}"></property>
</dataSource>
</environment>
</environments>
<!-- 定义映射文件 -->
<mappers>
<!-- <mapper resource="com/geyao/mybatis/mapper/BlogMapper.xml"></mapper> -->
<package name="com.geyao.mabatis.mapper"></package>
</mappers>
</configutation>