{"repo":"Dhi13man/spring-multi-data-source","free":true,"listed":false,"github":"https://github.com/Dhi13man/spring-multi-data-source","clone":"git clone https://github.com/Dhi13man/spring-multi-data-source.git","description":"To mitigate Spring's limitations with multiple data sources in a single service, this library provides two custom Java annotations that automatically generate all the required bean definition configurations, and package-segregated repositories, for each data source.","language":"Java","stars":14,"topics":["annotation-processor","annotations","database","java","maven","spring","spring-boot"],"license":"GPL-3.0","category":"databases-storage","readme_excerpt":"spring-multi-data-source Spring Boot has multiple limitations when using multiple data sources in a single service. This project aims to solve those limitations by providing custom annotations that can be used to generate the required Bean-providing configuration classes and repositories during the build process itself, which the service can then use. The best part is that the entirety of the generated code is clean, human-readable, and can be directly carried over to the relevant packages of the main code if you no longer wish to be tied down to this library in the future. Table of Contents spring-multi-data-source Table of Contents Introduction Annotations Provided @EnableMultiDataSourceConfig @EnableMultiDataSourceConfig.DataSourceConfig @TargetSecondaryDataSource Usage Building from Source (Maven) Removing Dependency on spring-multi-data-source without Losing Functionality Contributing License Resources Introduction The limitations of using multiple data sources in a single service in Spring are: 1. We need to split the packages of repositories to allow one @EnableJpaRepositories mapped to one package for each data source. 2. There is a lot of boilerplate config generation involved to create beans of data sources, entity managers, transaction managers etc. for each data source. 3. To get 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. To mitigate the above limitati","default_branch":null,"files":null,"tree":[],"storefront":"/r/Dhi13man","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/Dhi13man/spring-multi-data-source/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}