版本: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