Open odrotbohm opened 8 years ago
HibernateJpaAutoConfiguration
creates more than just a LocalContainerEntityManagerFactoryBean
so I don't think it would be appropriate for everything to back off purely because there's a user-declared LocalContainerEntityManagerFactoryBean
in the context.
That said, the LocalContainerEntityManagerFactoryBean
is the only auto-configured bean that depends on the DataSource
so it might be possible to restructure things so that only that bean backs off when there are multiple DataSource
beans in the context. That would make this a duplicate of #5541.
Yeah, I've seen EntityManagerFactoryBuilder
being created, which would indeed be helpful to even set up the manually declared instances. If we could untangle those parts, perfect!
An interesting side-effect of isolating the auto-configuration of the LocalContainerEntityManagerFactoryBean
to be the only part that requires a DataSource
is that you then get various JPA-related beans being auto-configured even if there's no DataSource
in the context. We could almost do with it all being conditional on at least one DataSource
bean and then the LocalContainerEntityManagerFactoryBean
being conditional on a single DataSource
.
This turns out to be not so easy. We'll need a bit more time to play with some ideas so it's unlikely to make 1.4.