admin管理员组文章数量:1291024
Stack overflow gurus,
I have perused through multiple stack overflow links and gone through various articles but haven't got a solution for my specific use case. Here is my use case. I am using spring boot 3.4.1 with com.zaxxer:HikariCP:jar:4.0.3. My passwords are got from a vault (Cyberark) . We are using oracle and mongodb as the databases. When the system comes up , I have my DataSource bean(created through DataSourceBuilder) that gets the user name and password from the vault and it sets up the connection. Issue happens when after a few days when the password changes in the vault which could be anytime. My application connection pool gets a couple of incorrect username and password exceptions and then it locks after a few retries . Following are my questions.
- Since i am writing a library that is being used across a few projects, i want the library to handle this situation and reestablish connection with the new user/password. Is there a global way to do this (With REST we can do it with @ControllerAdvice , do we have something similar to that that i can do in the library ) so that i can introduce this exception handling at the library level.
- Once i have my exception handler i was thinking of using softEvictConnections and then resetting the datasource user and password . Do we have any clean code snippet that we can reuse for this as well ?
- I really think that the only way to fix this the right way is to handle the authentication exception and then reset the password so that i don't need to keep getting the passwords every time/few times for the edge case that the vault password could have changed as it could be weeks or months by the time the password gets changed. Are there any established patterns for dynamic password changes that we could lean on.
版权声明:本文标题:Dynamic password change using Hikari CP to avoid database locks on a spring boot application - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741520050a2383127.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论