springboot + mybatis设置将SQL语句打印到控制台

时间:2024-10-30 11:39:00

如果是

=debug

若果是

logging:
  level:
    : DEBUG
是 mybatis接口及映射文件包。

改成

yml文件的好处,天然的树状结构,一目了然


=8090
-timeout=30
-path=
-threads=0
-encoding=UTF-8

 = jdbc:mysql://localhost:3306/newbirds
 = root
 = mymysql
 = 
# Specify the DBMS
 = MYSQL
# Show or not log for each sql query
-sql = true
# Hibernate ddl auto (create, create-drop, update)
-auto = update
# Naming strategy
-strategy = 

# stripped before adding them to the entity manager)
 = .MySQL5Dialect

server:
  port: 8090
  session-timeout: 30
  -threads: 0
  -encoding: UTF-8

spring:
  datasource:
    url : jdbc:mysql://localhost:3306/newbirds
    username : root
    password : mymysql
    driverClassName : 
  jpa:
    database : MYSQL
    show-sql : true
    hibernate:
      ddl-auto : update
      naming-strategy : 
    properties:
      hibernate:
        dialect : .MySQL5Dialect
注意点:

1,原有的key,例如,按“.”分割,都变成树状的配置

2,key后面的冒号,后面一定要跟一个空格

3,把原有的删掉。然后一定要执行一下  maven -X clean install