Getting NoUniqueBeanDefinitionException when extends QueryDslRepositorySupport and multiple datasources
Solved myself:
I'm check QueryDslRepositorySupport.class
and found out.
@PersistenceContext
public void setEntityManager(EntityManager entityManager) {
Assert.notNull(entityManager);
this.querydsl = new Querydsl(entityManager, builder);
this.entityManager = entityManager;
}
@PersistenceContext have not "unitName" So, Spring can't inject EntityManager.
I create QueryDslRepositorySupportWrapper.java
and inject EntityManager manually.
And It works.
https://github.com/okihouse/spring-boot-multiple-datasource-with-querydsl