Mybatis(三)常用配置資訊

2021-10-07 15:21:19 字數 1264 閱讀 1420

springboot+mybatis整合過程中,開啟控制台sql語句列印的多種方式:

附:mybatis官方文件

1.在mybatis的配置檔案中新增:

mybatis的配置檔案----mybatis-config.xml如下:

<?xml version="1.0" encoding="utf-8" ?>

mybatis:

configuration:

log-impl: org.apache.ibatis.logging.stdout.stdoutimpl

ps:

控制台可以列印了。。。。。

logging:

level:

如果你使用的是springboot+mybatis-plus的話:

com.baomidou

mybatis-plus-boot-starter

3.3.1

mybatis-plus:

configuration:

log-impl: org.apache.ibatis.logging.stdout.stdoutimpl

控制台列印: 

creating a new sqlsession

sqlsession [org.apache.ibatis.session.defaults.defaultsqlsession@7b1c1a91] was not registered for synchronization because synchronization is not active

==> preparing: select cron from cron_table where cron_type = ?

==> parameters: springboot_timedtask_2(string)

<== columns: cron

<== row: 0/5 * * * * ?

<== total: 1

closing non transactional sqlsession [org.apache.ibatis.session.defaults.defaultsqlsession@7b1c1a91]

配置資訊 類

常用的配置包括 資料庫連線,系統配置 檔案分布之類 應用配置 業務邏輯資料 其它 為方便程式獲取配置資訊,設計此類 獲取配置資訊類 class sconfig private static database 快取資料庫配置資訊 private static system 快取系統配置資訊 priva...

Hystrix 配置資訊

在hystrix中我們一般是用的預設配置,有些時候需要調整一些引數來獲取更好的處理效能 配置官方文件 這些引數可以應用於hystrix的thread和semaphore策略 collapser properties 相關引數 requests per second at peak when heal...

Hystrix 配置資訊

在hystrix中我們一般是用的預設配置,有些時候需要調整一些引數來獲取更好的處理效能 配置官方文件 這些引數可以應用於hystrix的thread和semaphore策略 執行緒數預設值10適用於大部分情況 有時可以設定得更小 如果需要設定得更大,那有個基本得公式可以follow requests...