-
Notifications
You must be signed in to change notification settings - Fork 41.6k
Description
In Spring Boot 2.3.0 we've introduced deferred JPA bootstrap by default. As a result we got a number of deadlock-related issues. Some relate to the way our own code was interacting with the EntityManagerFactory or how the framework was applying locks and we fixed those. But others were report of user apps that look incidental, for instance using a repository in @PostConstruct.
After considering the pros and cons of each approach, we've decided that asynchronous bootstrap mode should be opt-in and that we should clarify its behaviour and how users can easily opting-in to it, including if they have to manipulate the EMF on startup.
This issue is about flipping the default value. While it is late in the 2.3.x cycle to do so, it is an optimisation and switching back to the previous behaviour should not have any user-facing consequence. The release notes for 2.3.x should also be updated.
Two companion issues are also available to generalize the spring.data.jpa.repositories.bootstrap-mode property (#24248) and to provide a mechanism to know that the EMF lock has been lifted (see spring-projects/spring-framework#26153).