Posted Jul 22, 2024
This library provides two custom annotations in Java that make integration of multiple Data Sources in Spring Boot seamless. It is used by a big Indian company.

@EnableJpaRepositories mapped to one package for each data source.EntityManagerFactoryBuilder injected, we need to declare one of the data sources and all its beans as @Primary. Otherwise, the service won't even start up. @EnableJpaRepositories and @EntityScan annotations used by Spring.\@EnableMultiDataSourceConfig. It can not be applied directly anywhere other than in the dataSourceConfigs attribute of @EnableMultiDataSourceConfig.target/generated-sources/annotations directory.implements IMultiDataSourceConfig from the generated @Configuration classes.@EnableMultiDataSourceConfig annotation from your configuration class.@TargetSecondaryDataSource annotation from your repository methods.spring-multi-data-source dependency from your project pom.