Dynamic-datasource is an extremely simple spring-boot-based multi-data source component, which can make your system support multiple data sources easily and quickly.
https://dynamic-datasource.com/Official website
It also provides support for various third parties and has extremely high scalability.
But the aop-based program always has a problem that is difficult to solve, that is, the transaction problem.
The authors of this project often receive the following questions.
- Why did I add spring transaction annotations and fail to switch data sources?
- I understand that distributed transactions are involved, and I know that the project can easily integrate seata. But my scenario is simple, is there a solution that does not rely on third parties?
Since 3.3.0, seata's core contributor https://github.com/a364176773 has contributed a connection proxy-based solution.
There will definitely be some problems in the first version. It is recommended that you carefully test it locally before launching it into production. I hope you have more comments.
https://dynamic-datasource.com/guide/tx/Local.html official website to view detailed documents.
v3.3.0
- feat: Important: local multi-data source transaction support. @FUNKYE
- feat: The storage method of the underlying data source is modified to ConcurrentHashMap. @刘尚
- revert: Refactor the creation rules of the underlying Creator. @刘尚
- feat: Add a data source with the same name to overwrite the old data source. @刘尚
- feat: Support some scenarios where DS is inherited from the interface. @CQJames
- fix: Fix a parameter setting error of Druid firewall. @mrf
- fix: Fix the abnormal handling of setting data source in extreme cases. @happier233
characteristic
- Support data source grouping , suitable for multiple scenarios, pure multi-database read-write separation, one-master multi-slave mixed mode.
- Supports ENC() encryption of database sensitive configuration information .
- Support each database to initialize the table structure schema and database independently.
- Support custom annotations , need to inherit DS (3.2.0+).
- Provide quick integration of Druid, Mybatis-Plus, P6sy, Jndi.
- Simplify the configuration of Druid and HikariCp and provide global parameter configuration . Configure once, globally.
- Provide custom data source source program.
- Provide a program for dynamically adding and removing data sources after the project is started .
- Provide a pure read-write separation solution in the Mybatis environment .
- Provide a data source solution using Spel dynamic parameters . Built-in spel, session, header, support customization.
- Support multi-level data source nested switching . (ServiceA >>> ServiceB >>> ServiceC).
- Provide solutions, precautions and examples for the integration of shiro, sharding-jdbc, quartz and other third-party libraries.
- Provide a distributed transaction solution based on seata. Attachment: Native spring transactions are not supported.
- Provide local multi-data source transaction program. Attachment: Native spring transactions are not supported.