Spring Boot AbstractDataSourceBasedMultitenantConnectionProviderImpl以及共享数据库
我目前有多个租赁数据库来实现AbstractDataSourceBasedMultitenantConnectionProviderImpl
。
值得庆幸的是,这很好。现在,我必须将数据库添加到可以与所有租户共享的组合中。
我尝试添加多个数据源,添加了一个新的数据源配置以及类似的内容。我在调试中看到连接字符串是正确创建的,并使用应用程序属性文件中指定的详细信息。
问题始于任何尝试从共享数据库读取数据的尝试。无论我做什么,getConnection
函数都在atrackdaSourceBasedMediteNantConnectionProviderImpl
中调用,并将数据库连接字符串更改为租户数据库。
是否有一种方法可以检查数据源并验证它是否进入共享数据库,或者我在这里错过了一些简单的东西?
I currently have multi tenancy database working by implementing AbstractDataSourceBasedMultiTenantConnectionProviderImpl
.
This is working great thankfully. Now I must add a database to the mix that can be shared to with all tenants.
I have attempted adding multiple datasources, I added a new datasource config and things like that. I see in debug the connection string is created correctly with the details specified in the application properties file.
The problems start on any attempt to read data from the shared database. No matter what I do the getConnection
function is called in the AbstractDataSourceBasedMultiTenantConnectionProviderImpl
and changes the datasource connection string to the tenanted database.
Is there a way to check the datasource coming in and validate it if its going to the shared db or am I missing something simple here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我解决了这个问题。一切都归结为包装。我需要更明确地扫描包装,并明确扫描实体。
I solved this. It all came down to packaging. I needed to be more explicit on the packages being scanned and scan the entities explicitly as well.