如何使用SpringBoot和Mybatis-Plus实现两种打印SQL语句的技术?

2026-05-16 06:250阅读0评论SEO资源
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计362个文字,预计阅读时间需要2分钟。

如何使用SpringBoot和Mybatis-Plus实现两种打印SQL语句的技术?

1. 使用MyBatis-Plus配置说明 - 在yml文件中进行配置,如下所示: yaml mybatis-plus: mapper-locations: classpath:mapper/**.xml configuration: log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

1.注解方式,yml文件配置上以下就可以直接使用

mybatis-plus: mapper-locations: classpath:mapper/*.xml configuration: log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

2.这一种网上没有,搜过好多资料都没有,我是配置多数据源,所以是在代码中写的config那么yml文件就是失效的,只能一个一个配置,到了打印sql的时候,就怎么都是找不到,后来设置的源码找到灵感,发现可以使用,特此记下,方便其他小伙伴遇到同样的问题使用。

阅读全文

本文共计362个文字,预计阅读时间需要2分钟。

如何使用SpringBoot和Mybatis-Plus实现两种打印SQL语句的技术?

1. 使用MyBatis-Plus配置说明 - 在yml文件中进行配置,如下所示: yaml mybatis-plus: mapper-locations: classpath:mapper/**.xml configuration: log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

1.注解方式,yml文件配置上以下就可以直接使用

mybatis-plus: mapper-locations: classpath:mapper/*.xml configuration: log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

2.这一种网上没有,搜过好多资料都没有,我是配置多数据源,所以是在代码中写的config那么yml文件就是失效的,只能一个一个配置,到了打印sql的时候,就怎么都是找不到,后来设置的源码找到灵感,发现可以使用,特此记下,方便其他小伙伴遇到同样的问题使用。

阅读全文