1.导入jar包
asm-3.3.1.jar
c3p0-0.9.1.2.jar
cglib-2.2.2.jar
commons-logging-1.1.1.jar
ehcache-core-2.6.8.jar
javassist-3.17.1-GA.jar
log4j-1.2.17.jar
log4j-api-2.0.2.jar
log4j-core-2.0.2.jar
mybatis-3.2.8.jar
mybatis-ehcache-1.0.3.jar
mysql-connector-java-5.1.7-bin.jar
slf4j-api-1.7.5.jar
slf4j-log4j12-1.7.5.jar
2.创建配置文件
①jdbc.properties
jdbc.user=root
jdbc.password=root
jdbc.driverClass=com.mysql.jdbc.Driver
jdbc.jdbcUrl=jdbc:mysql://localhost:3306/mybatis
②log4j.properties
log4j.rootLogger=DEBUG,myConsole
log4j.appender.myConsole=org.apache.log4j.ConsoleAppender
log4j.appender.myConsole.Threshold=DEBUG
log4j.appender.myConsole.ImmediateFlush=true
log4j.appender.myConsole.Target=System.out
log4j.appender.myConsole.layout=org.apache.log4j.PatternLayout
log4j.appender.myConsole.layout.ConversionPattern=[%-5p] %d(%r) --> [%t] %l: %m %x %n
③mybatis-config.xml
[可参照