Description
Juergen Hoeller opened SPR-13732 and commented
Traditionally, the bottleneck in the startup performance of Spring applications is the initialization of expensive resources such as a JPA EntityManagerFactory
or a Hibernate SessionFactory
.
As an alternative to generalized parallel initialization of beans, we might be able to achieve some significant gain through specific background initialization options in LocalContainerEntityManagerFactoryBean
/ LocalSessionFactoryBean
/ LocalSessionFactoryBuilder
, internally passing the actual build call on to a background thread after configuration validation and in particular dependency resolution happened. The exposed EntityManagerFactory
/ SessionFactory
proxy (which we have for other reasons already) could then simply delegate method invocations to a Future
of the target resource until it is known to be resolved, which is likely not to come before the very end of the startup phase.
Issue Links:
- Parallel bean initialization during startup [SPR-8767] #13410 Parallel bean initialization during startup
- DATAJPA-1397 Add support for deferred repository initialization
- Improve performance of #getBeanNamesForType() while the BeanFactory configuration is not yet frozen [SPR-13610] #18188 Improve performance of #getBeanNamesForType() while the BeanFactory configuration is not yet frozen
- Background initialization for Hibernate SessionFactory breaks transaction management [SPR-14379] #18952 Background initialization for Hibernate SessionFactory breaks transaction management
- Asynchronous initialization of beans during startup [SPR-14920] #19487 Asynchronous initialization of beans during startup
- Mention asynchronous JPA bootstrapping in the reference documentation [SPR-17189] #21724 Mention asynchronous JPA bootstrapping in the reference documentation
- Hibernate5 metadata access [SPR-13710] #18285 Hibernate5 metadata access
Referenced from: commits db1171d, 09cea6e
1 votes, 9 watchers