java - How to delegate Spring services to a different database? -
I have different classes, which are Now I want to create a service that should be connected to a different database. This means that I have to inject a different M / Datasource. But how can I force a database for spring beans / services? There are several ways to do this. What we have done in one of our projects is that it defines two different packages for different data sources and define the beans separately for them: Similarly, defining the entity manager factory. In this manner, whatever repositories are defined in package ABC will use abcEntityManager and similar to DF. The way I worked on it is in other ways implementing the transaction with the appropriate unit manager: in the extension of the crad registrar; spring data of JPA framework
EntityManager bean.
@ Transaction ("abcTransactionManager")
Comments
Post a Comment