• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

JPA Data Repository - 2 beans of type EntityManager found

 
Markus Kirschenbaum
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Markus Kirschenbaum
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did anyone get an idea how to solve that?
I think it could be that the auto-configured bean conflicts with the bean manually created.
 
Markus Kirschenbaum
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any help would be appreciated, this bug is really killing me...
 
Himai Minh
Bartender
Posts: 2119
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I noticed something in your code:

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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic