Is it safe to pass in the Spring Application Context into a ThreadLocal associated with a request?

后端 未结 1 907
半阙折子戏
半阙折子戏 2021-01-29 03:17

In JPA I want to utilize the PrePersist annotated method to perform some operations but rather than making the things it needs to implement the Singleton pattern (w

1条回答
  •  余生分开走
    2021-01-29 03:51

    If you can use Hibernate event listeners I wrote once a response with a possible approach for Spring managed event listeners here:

    Using Hibernate 4's Integrator pattern and Spring's dependency injection

    0 讨论(0)
提交回复
热议问题