且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Spring JPA 数据源崩溃恢复和运行时动态变化

更新时间:2023-09-21 18:35:04

你可以简单地实现你自己的 DataSource,它委托给真正的 DataSource 并在密码更改.

You can simply implement your own DataSource that delegates to the real DataSource and creates a new one when the password changes.

DelegatingDataSource 可能会有所帮助,无论是作为基础类,还是因为您要将 DataSource 更改为实现的模板.