1 log4j配置文件
#mybatis部分
log4j.logger.com.ibatis=DEBUG
log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=DEBUG
log4j.logger.com.ibatis.common.jdbc.ScriptRunner=DEBUG
log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=DEBUG
#与sql相关
log4j.logger.java.sql.Connection=DEBUG
log4j.logger.java.sql.Statement=DEBUG
log4j.logger.java.sql.PreparedStatement=DEBUG
WEB-INF/classes目录下conf目录
建立mybatis-config.xml
-
<?xml version="1.0" encoding="UTF-8"?>
-
<!DOCTYPE configuration
-
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
-
"">
-
<configuration>
-
<settings>
-
<!-- 打印查询语句 -->
-
<setting name="logImpl" value="STDOUT_LOGGING" />
-
</settings>
-
-
</configuration>
spring-mybatis.xml
-
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
-
<property name="dataSource" ref="dataSource" />
-
<property name="configLocation" value="classpath:conf/mybatis-config.xml"></property>
-
<!-- 自动扫描mapping.xml文件 -->
-
<property name="mapperLocations" value="classpath:com/xxxx/dao/*.xml"></property>
-
</bean>
阅读(1192) | 评论(0) | 转发(0) |