mybatis3.2.7有一个bug,使用log4j2 (2.0.2)版本时,会找不到类 ,导致启动失败,详见
https://github.com/mybatis/mybatis-3/issues/235
但没过多久 , 3.2.8就已经修复了这个bug , 最新的mybatis3.2.8下载地址为:
https://github.com/mybatis/mybatis-3/releases
mybatis 3.2.8 整合 log4j2.0.2并不复杂 , 如果用spring-mvc做为web框架 , 以下是使用步骤:
1. pom.xml添加依赖项
1 <dependency> 2 <groupId>org.slf4j</groupId> 3 <artifactId>slf4j-api</artifactId> 4 <version>1.7.7</version> 5 </dependency> 6 <dependency> 7 <groupId>org.apache.logging.log4j</groupId> 8 <artifactId>log4j-api</artifactId> 9 <version>${log4j2.version}</version> 10 </dependency> 11 <dependency> 12 <groupId>org.apache.logging.log4j</groupId> 13 <artifactId>log4j-core</artifactId> 14 <version>${log4j2.version}</version> 15 </dependency> 16 <dependency> 17 <groupId>org.apache.logging.log4j</groupId> 18 <artifactId>log4j-web</artifactId> 19 <version>${log4j2.version}</version> 20 </dependency> 21 <dependency> 22 <groupId>org.apache.logging.log4j</groupId> 23 <artifactId>log4j-slf4j-impl</artifactId> 24 <version>2.0.2</version> 25 </dependency>