I am working on spring boot multi tenancy application. I have configured multi datasources as shown below :
application.properties
spring.multitenanc
You need 2 different persistence factories, not one, each should produce different EntityManagers for different datasources. Also each entity mapping should be marked to been used only with one entity manager. See full solution here:
http://www.baeldung.com/spring-data-jpa-multiple-databases