Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

同时配置数据库密码加密和多数据源增强的时候,出错 #256

Open
slzwx2004 opened this issue Sep 26, 2024 · 0 comments
Open

Comments

@slzwx2004
Copy link

按顺序执行以下配置:
1、集成dynamic-datasource实现多数据源增强
2、集成druid实现数据库密码加密功能
运行的时候,报数据库密码不对,跟踪源码发现包dynamic-datasource-spring-boot-starter.3.5.2.jar中的类com.baomidou.dynamic.datasource.spring.boot.autoconfigure.druid.DruidConfig.toProperties(DruidConfig g) 无法正常加载publicKey,方法中没有设置publicKey属性的代码,导致connectProperties的值也没办法正常设置,相关源码如下:

Properties connectProperties = connectionProperties == null ? g.getConnectionProperties() : connectionProperties;
if (publicKey != null && publicKey.length() > 0) {
    if (connectProperties == null) {
        connectProperties = new Properties();
    }
    connectProperties.setProperty("config.decrypt", Boolean.TRUE.toString());
    connectProperties.setProperty("config.decrypt.key", publicKey);
}
this.connectionProperties = connectProperties;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant