I have 2 databases with identical schemas, but for 2 different markets (let's say us-db and eu-db). Since the schemas are identical, I can use the same entity classes - the publisher table is the same in both databases, so I only need 1 Publisher class. It follows, that I only need a single Repo:
@Repository
public interface PublisherRepository extends CrudRepository<Publisher, Long> {
}
However, I would like to set it up so that my Spring Context contains 2 Beans of type PublisherRepository - one where the underlying datasource is us-db, and the other - eu-db.
Is it possible to achieve this? I'm also open to other implementation suggestions that eliminate the need for duplication of entity definitions.