日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學(xué)無(wú)先后,達(dá)者為師

網(wǎng)站首頁(yè) 編程語(yǔ)言 正文

spring-boot jpa 實(shí)現(xiàn)攔截器 StatementInspector

作者:Jothan Zhong 更新時(shí)間: 2024-01-15 編程語(yǔ)言

springbootjpa實(shí)現(xiàn)sql攔截的方式很簡(jiǎn)單,只要實(shí)現(xiàn) StatementInspector 接口既可以。

package com.zsh.masterdata.config;

import org.hibernate.resource.jdbc.spi.StatementInspector;
public class JpaStatementInspector implements StatementInspector {

    @Override
    public String inspect(String s) {

        System.out.println("sql攔截器:-------------");
        System.out.println(s);
        return s;
    }
}

application.yml中加入配置

spring:
  jpa:
    properties:
      hibernate:
        session_factory:
          statement_inspector: com.zsh.masterdata.config.JpaStatementInspector

原文鏈接:https://blog.csdn.net/qq_43985303/article/details/129809552

  • 上一篇:沒(méi)有了
  • 下一篇:沒(méi)有了
欄目分類(lèi)
最近更新