spring add datasource at runtime

怎甘沉沦 提交于 2019-12-20 10:46:12

问题


I am working on a spring boot multi-tenant application with database per tenant strategy. Requirement is that to add new databases at runtime which means I have to create new datasource objects dynamically.

I also looked upon Spring's AbstractRoutingDataSource but in needs pre-defined datasources. So I just want to know how to add/remove datasource without restarting application server.

Thanks in advance.


回答1:


I finally managed to get things working straight. For someone having same issue, just check this multi-tenant demo project.



来源:https://stackoverflow.com/questions/46515298/spring-add-datasource-at-runtime

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!