Spring Boot 2.0.0 M6 - Add Hibernate Interceptor

前端 未结 3 1680
星月不相逢
星月不相逢 2021-01-05 09:03

After upgrade from Spring Boot 2.0.0 M2 to 2.0.0 M6 my Hibernate interceptor implementation don\'t work anymore.

My old implementation:

@Configuratio         


        
3条回答
  •  不思量自难忘°
    2021-01-05 09:40

    Hello,

    Give this a read: https://github.com/spring-projects/spring-boot/commit/59d5ed58428d8cb6c6d9fb723d0e334fe3e7d9be (use: HibernatePropertiesCustomizer interface)

    1. Implement it.
    2. @Override customize() method, add your interceptor
    3. Don't forget to @Lazy inject in case of internal beans
    4. Done => Run

    Hope this was of use to you.

    As a final note: always update your Spring / Hibernate versions (use the latest as possible) and you will see that most code will become redundant as newer versions try to reduce the configurations as much as possible.

提交回复
热议问题