springboot 配置mybatis打印sql - 傻不拉几猫 - 博客园

方式 一:

########################################################  
###配置打印sql  
########################################################  
logging:  
    level:  
      com.threefivework.mymall.dao.mapper: DEBUG //包路径为mapper文件包路径  

方式二:

在application.yml(.properties)中增加配置,在控制台打印sql:

mybatis
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl 

亲测 properties

#mybatis
# 这样也行
# mybatis.mapper-locations=classpath:mapper/*.xml,classpath:mapper/x/*.xml
# 同样效果
mybatis.mapper-locations=classpath:mapper/*.xml,mapper/x/*.xml
mybatis.typeAliasesPackage=cn.superdesk.app.superservice.dao.entity
mybatis.configuration.map-underscore-to-camel-case=true
mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl

参考类:org.apache.ibatis.session.Configuration
log-impl指定的值为org.apache.ibatis.logging.Log接口的某个实现类


Original url: Access
Created at: 2019-09-25 13:54:19
Category: default
Tags: none

请先后发表评论
  • 最新评论
  • 总共0条评论