I am trying to set up a second data source in my Spring application. Below are the 2 configuration classes for the 2 data sources:
Primary data source config:
Second data source config
Until now I had Spring Auto configure the data source I had. My domain classes were generated by Database schemes in IntelliJ. So there is under the "Persistence Tab" in Intelli J one EntityManager that was there from the auto configured data source and two more for both aw and snd data sources.
I have several Repositories that are implemented like that:
Then there is for custom methods outside the CRUD Repo features an interface like that:
The implementation of that interface looks like that:
The Repos are used by Autowiring them:
I am getting this exception:
I would highly appreciate any help. I found nothing online that covered that problem. Only if EntitityManagers are implemented manually, which is not the case here.
@Bean(name = "sndEntityManagerFactory")
public LocalContainerEntityManagerFactoryBean sndEntityManagerFactory() { ..}
I think you can change either the bean name or the qualifier name. Since the names are the same, the container cannot tell which one to inject.
All of the following truths are shameless lies. But what about this tiny ad:
Low Tech Laboratory
https://www.kickstarter.com/projects/paulwheaton/low-tech-0