spring boot druid 密码加密

1. 在druid jar包的目录下运行:

java -cp druid-1.0.16.jar com.alibaba.druid.filter.config.ConfigTools you_password

控制台输出:

privateKey:MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAu6rkW3YjmnzJqLpDn0/0HkcJGR15Bb+sphO2JV1yDmstSORQZl6A7+uFqaA6RZpeLUA8GBv/p0RJhQwBdmdnawIDAQABAkAECOOJ99tCGga34vFLPovQDtTqPlD4x6stkuTqnryyBKBkrvuuI5Q0cWN5kQg5is9eiljJHyJE3xvGqjGhGF9ZAiEA9EJXvwlP0254hfWt9GZ3xRlmRmk7Gq6UE7rf3XGnftUCIQDEsC2o9f4U4gABKiJG2366/V+fqLc3dROoeg2QQLTtPwIgVggD9eJmvlablrtIsNtidgaTMlugGK7CswxQCyQb1Z0CIDZqE0fCPnfiimPIF1GJGgd7X4AZOg7yqeybT7NP434bAiEAq1CfCE8TPFKkqjgBQZ+MnnAdkg9icgIlg0/gBvbTajk=
publicKey:MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALuq5Ft2I5p8yai6Q59P9B5HCRkdeQW/rKYTtiVdcg5rLUjkUGZegO/rhamgOkWaXi1APBgb/6dESYUMAXZnZ2sCAwEAAQ==
password:rjb2O1/I/WyihlDFNZOOKEKZBrnVIXTmWhGz6tk+k2GNEqrkwsouQs1eFpR6QAzVmPZto+u943aX+FH8LHbMkA==

2.配置yaml文件

spring:
  main:
    banner-mode: off
  datasource:
    type: com.alibaba.druid.pool.DruidDataSource
    driver-class-name: com.mysql.cj.jdbc.Driver
    druid:
      url: jdbc:mysql://rm-2zeui918o9fhgdsfme69fo.mysql.rds.aliyuncs.com:3306/wechat-admin?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true
      username: xxxx
      password: T0SfJGsdfMD6XGYldQ56Zx6MZMsdf0Wx3ZnGZKbRYVGc7z8UPTfVwmwxrp5PXcYkoWDRu3ULULMOC2V73Lgho7J83NfQ==
      connect-properties:
        config.decrypt: true
        config.decrypt.key: MFwwDQYJsKoZIhvcNAQEsdfsdBBQADSwAwSAJBAfsJ2ZZoLS7yFBHlCPdW/rcuhp7qMktU335w9PgRMljl2E3J/Zm/89hdkkqG+j/cubv33UqsCJQKfdn4cwiIs1Abpd8CAwEAAQ==
      

 

posted @ 2021-07-01 11:47  芬尼克斯  阅读(585)  评论(0编辑  收藏  举报