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
Hello,
Give this a read: https://github.com/spring-projects/spring-boot/commit/59d5ed58428d8cb6c6d9fb723d0e334fe3e7d9be (use: HibernatePropertiesCustomizer interface)
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.
I can solve this with this documentation:
Add support for advanced customization of Hibernate settings
Just implements a interface HibernatePropertiesCustomizer
and implements methods customize(Map<String, Object> hibernateProperties)
@Component
class MyHibernateInterceptorCustomizer implements HibernatePropertiesCustomizer {
@Autowired
MyInterceptor myInterceptor
@Override
void customize(Map<String, Object> hibernateProperties) {
hibernateProperties.put("hibernate.session_factory.interceptor", myInterceptor);
}
}
As https://github.com/spring-projects/spring-boot/issues/11211 has been resolved, HibernatePropertiesCustomizer
can be used since Spring Boot 2.0.0.RC1 (not released at the moment of writing yet but snapshots are available now).