ssm整合后打印日志查看执行sql语句
mybatis.xml
<?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>
<settings>
<!--打印日志可以看执行的sql语句-->
<setting name="logImpl" value="STDOUT_LOGGING"/>
</settings>
</configuration>
spring.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"> <!--第一步,扫描service-->
<context:component-scan base-package="com.guangming.service.impl"></context:component-scan>
<!--第二步,加载jdbc.properties-->
<context:property-placeholder location="classpath:jdbc.properties"></context:property-placeholder>
<!--第三步,创建dbcp数据源连接池-->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="${driver}"></property>
<property name="url" value="${url}"></property>
<property name="username" value="${user}"></property>
<property name="password" value="${password}"></property>
</bean>
<!--第四步,创建mybatis的工厂类对象-->
<bean class="org.mybatis.spring.SqlSessionFactoryBean">
<!--指定数据源-->
<property name="dataSource" ref="dataSource"></property>
<!--加载mybatis的映射文件 在value中可以使用*号通配符-->
<property name="mapperLocations" value="classpath:com/guangming/dao/*.xml"></property>
<!--加载mybatis中的配置文件-->
<property name="configLocation" value="classpath:mybatis.xml"></property>
</bean>
<!--第五步,在spring 的工厂中生成dao接口的实现类对象 -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<!--指定要扫描哪个包下面所有的dao接口-->
<property name="basePackage" value="com.guangming.dao"></property>
</bean>
<!--第六步,创建spring的事物管理器-->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"></property>
</bean>
<!--第七步,声明以注解的方式配置声明式事物-->
<tx:annotation-driven transaction-manager="transactionManager" ></tx:annotation-driven> </beans>
ssm整合后打印日志查看执行sql语句的更多相关文章
- mysql查看执行sql语句的记录日志
开启日志模式 -- 1.设置 -- SET GLOBAL log_output = 'TABLE';SET GLOBAL general_log = 'ON'; //日志开启 -- SET GLOB ...
- laravel查看执行sql的
加个监听就好了~~~~而且很简单 1.在routes.php(api.php\web.php)中添加如下语句 Event::listen('illuminate.query', function($s ...
- ORA-01843: 无效的月份,执行sql语句更改为美国语言后仍然失败的解决办法
ORA-01843: 无效的月份失败的 sql 为:XXXXXXXXXXXXXXXX 执行sql语句更改为美国语言后仍然失败, ALTER SESSION SET NLS_DATE_LANGUAGE= ...
- [sqlserver脚本]查看指定SQL语句生成了哪些执行计划
参考SQL技术内幕写了一段脚本,可以通过这段脚本查看执行指定SQL语句后,系统生成了哪些执行计划.使用时注意以下几点: 修改use MyTest,换成自己的数据库名字. 将 exec sp_page_ ...
- 解决Mysql搭建成功后执行sql语句报错以及区分大小写问题
刚搭建完mysql 8.0以后会: 一.表区分大小写, 二.执行正确的sql语句成功且会报:[Err] 1055 - Expression #1 of ORDER BY clause is not i ...
- 使用BAT批处理执行sql语句的代码
使用BAT批处理执行sql语句的代码 有时候需要执行一些Sql语句时,不想开企业管理器,或者是发给客户执行但那边又不懂代码,这时就可以用下面方法 1.把待执行Sql保存在一个文件,这里为2011022 ...
- 使用Hive或Impala执行SQL语句,对存储在Elasticsearch中的数据操作(二)
CSSDesk body { background-color: #2574b0; } /*! zybuluo */ article,aside,details,figcaption,figure,f ...
- 使用Hive或Impala执行SQL语句,对存储在Elasticsearch中的数据操作
http://www.cnblogs.com/wgp13x/p/4934521.html 内容一样,样式好的版本. 使用Hive或Impala执行SQL语句,对存储在Elasticsearch中的数据 ...
- [转]在EntityFramework6中执行SQL语句
本文转自:http://www.cnblogs.com/wujingtao/p/5412329.html 在上一节中我介绍了如何使用EF6对数据库实现CRDU以及事务,我们没有写一句SQL就完成了所有 ...
随机推荐
- Tomcat5启动流程与配置详解
标签:配置 tomcat 休闲 职场 原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://zhangjunhd.blog.51cto. ...
- Springboot系列(七) 集成接口文档swagger,使用,测试
Springboot 配置接口文档swagger 往期推荐 SpringBoot系列(一)idea新建Springboot项目 SpringBoot系列(二)入门知识 springBoot系列(三)配 ...
- linux下DNS服务器搭建,正反向解析配置
dns服务器之前自己搭建玩过,一段时间不搞,加上当时没写文档,基本忘光光了,这次老实了,写个文档记下来,方便以后查阅. 1.服务器准备 为了避免不必要的问题,关闭防火墙,关闭selinux,hosts ...
- TCP的分分合合(面试必问)
TCP连接与断开 目录 TCP连接与断开 前言 握手 挥手 最后 前言 相信面试过的小伙伴对这个话题应该不陌生,算是面试必问了,三次握手,四次挥手,以及其中的一些衍生问题. TCP/IP(Transm ...
- B - How many integers can you find 杭电1976
Now you get a number N, and a M-integers set, you should find out how many integers which are small ...
- 嵌入式-01-LinuxC语言
一.必备Linux命令和C语言基础 1.Linux环境搭建(在第一阶段有提及). 2.文件和目录相关命令(一) (1)Linux的文件系统结构 /bin./boot./dev./etc./home./ ...
- SringMVC入门程序
Spring MVC是Spring Framework的一部分,是基于Java实现MVC的轻量级Web框架 1.Spring优点 轻量级,简单易学 高效 , 基于请求响应的MVC框架 与Spring兼 ...
- 关于Google下插件SwitchyOmega用法
开启代理后,尽管访问很自由了,但是我的搬瓦工,是有流量限制的.所以,在之前,我开启一会自由访问模式(戏称),然后关一会,用来方便打开国内网站. 是的,我这么坚持了半个月,之后,就崩溃了,太尼玛繁琐了! ...
- php class 访问控制
属性(attribute ) 必须声明访问控制类型 类型: public 公用 protected 受保护的 private 私有的 public 类型的属性 可以在外部访问 protected 及 ...
- python学习13类2之封装
'''''''''面向对象三大特性:封装,继承,多态1.封装: 类中以_或者__的属性,都是私有属性,禁止外部调用.'''class Student(object): def __init__(sel ...