版本:spring boot 2.2.5.RELEASE
关于在springboot-jpa中拓展自定义拦截器的org.hibernate.EmptyInterceptor和org.hibernate.resource.jdbc.spi.StatementInspector的配置
当前版本正确的配置方式:spring.jpa.properties.hibernate.session_factory
- application.yml
spring:
jpa:
properties:
hibernate:
session_factory:
#org.hibernate.EmptyInterceptor类的拓展
interceptor: tk.jfree.jpa.interceptor.MyInterceptor
#org.hibernate.resource.jdbc.spi.StatementInspector的sql拦截
statement_inspector: tk.jfree.jpa.interceptor.PageInterceptor
- application.properties
#org.hibernate.EmptyInterceptor类的拓展
spring.jpa.properties[hibernate.session_factory.interceptor]tk.jfree.jpa.interceptor.MyInterceptor
#org.hibernate.resource.jdbc.spi.StatementInspector的sql拦截
spring.jpa.properties[hibernate.session_factory.statement_inspector]=tk.jfree.jpa.interceptor.PageInterceptor
本文详细介绍了在SpringBoot 2.2.5版本中如何配置自定义的Hibernate拦截器,包括EmptyInterceptor和StatementInspector的设置,通过application.yml或application.properties文件实现对SQL执行过程的精细控制。
616

被折叠的 条评论
为什么被折叠?



