Spring Framework supports a background setup of the JPA instructure in a separated thread. While the current section of the documentation explains the impact in terms of proxying, it does not explicitly warn users they should not attempt to use the EMF during the context bootstrap phase.
Related to that, there is a need to get a callback once the infrastructure has fully initialised and the lock is released. Publishing an event and documenting how users can listen to it could be a nice alternative to what they're currently doing in @PostConstuct
or other framework callbacks that are not recommended for this type of setup. If that's accepted, the event should be published either way so that users can rely on that if they chose to bootstrap the JPA infrastructure on the main thread.
Comment From: jhoeller
Let's make up our mind on this in the 6.2 timeframe, along with #21868.