Java real way of (1): SpringBoot used in the project Mybatis print Sql statement

SpringBoot used in the project Mybatis print Sql statement

If that actually used in the project will be used in many classic match SpringBoot + Mybatis development, database data obviously, but running is finding out, this time we have locally Debug, you need to print out the actual Sql Mybatis, Sql look with our expectations are the same, or get the Sql database in direct execution, look at the results.
Here are several brief usage of actual combat.

A method properties:
increase follows the profile application.properties

logging.level.com.marvin.demo.dao=debug 

[Note]: The next packet logging.level.com path is the method where the corresponding interface Mybatis generally where * .dao packet, and the packet is not located mapper.xml.
debug represents the log level.

Method two yml:
increase follows the profile application.yml

logging:
  level:
     com.marvin.demo.dao : debug 

Method three Mybatis Log Plugin:
installed in the IDEA plug-in Mybatis Log Plugin, as
IDEA in search Mybatis log Plugin
complete installation restart IDEA, can be seen in the Tools toolbar installed plug-ins:
After mounting position MyBatis Log Plugin
Click to open the window, when the Debug, the corresponding Sql statement can be output to this window for easy viewing.
This plug-in is quite easy to use, improve development efficiency artifact, it is strongly recommended.Log log output window

Welcome to add a number of public landlord, stepped onto the road Java's real! ! !
Java combat road
Author: how to change
copyright of all, please indicate the source, welcome to reprint

Guess you like

Origin www.cnblogs.com/theonesmx/p/11777507.html