Jfinal+Druid实现数据库密码加密部署

2018-02-27 11:51:13来源:oschina作者:山疯人点击

分享
##1、使用durid自带工具对数据库密码加密
java –cp druid-1.0.29.jar com.alibaba.druid.filter.config.ConfigTools 你的密码
privateKey:MIIBVQIBADANBgkqhkiG9w0BAQEFAASCAT8wggE7AgEAAkEArQGYBEvmbVa93W+XAlZOjLC2YZTqYJaNbXVqkrtRUgHaURMdPUqRAYhyYAZABESdjVYMLGzzV3RWCR+dhOEqvwIDAQABAkAEfC0Xt2wC26PScMkma1xf81jXEMg+tsh11PxtT2PdT1ntE0/6n0gRuSwC2MbFKRfBL7FcQtuzdkq3JwqPa1dxAiEA+C71r3naa6R6H0rSf0AUU7xL+KTU1o07kWwRREUI/bcCIQCydH/QA7zjEKBe1TJNzzVslLOBYUoRSkxUStK5T9S7OQIhAOWzENEIBo/5+s1bgtcjh6y4adgHNrYcoTVGv/RfsKKhAiEAsKDCSL8KW6v/Lx3RNlZayGe969bBmq9xMRUF0MkFA3ECIDPncPKeWUJiPv4EmBioXjJplDg+TWz4XJEn6aa8RB/T
publicKey:MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAK0BmARL5m1Wvd1vlwJWToywtmGU6mCWjW11apK7UVIB2lETHT1KkQGIcmAGQAREnY1WDCxs81d0VgkfnYThKr8CAwEAAQ==
password:ITY3+uEsU16TnGqqwqStpt/37K2VyuJaKPX1MH0Q+s/EzITfXvFytlDieOYR3ikaSGEht4GdKHA7y6y7LqaQ+w==
##2、设置jfinal 的a_little_config.txt
jdbcUrl = jdbc:sqlserver://localhost:1433;databaseName=xdb
driver = com.microsoft.sqlserver.jdbc.SQLServerDriver
user = sa
password = ITY3+uEsU16TnGqqwqStpt/37K2VyuJaKPX1MH0Q+s/EzITfXvFytlDieOYR3ikaSGEht4GdKHA7y6y7LqaQ+w==
filters = config
publickey = MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAK0BmARL5m1Wvd1vlwJWToywtmGU6mCWjW11apK7UVIB2lETHT1KkQGIcmAGQAREnY1WDCxs81d0VgkfnYThKr8CAwEAAQ==
devMode = true
##3、启动类中数据库连接池插件,黄色为相比不加密时的新加项
/**
* 配置插件
*/
public void configPlugin(Plugins me) {
// 配置 druid 数据库连接池插件
DruidPlugin druidPlugin = new DruidPlugin(PropKit.get("jdbcUrl"), PropKit.get("user"), PropKit.get("password").trim(),PropKit.get("driver").trim(),PropKit.get("filters").trim());
druidPlugin.setPublicKey(PropKit.get("publickey"));
me.add(druidPlugin);

// 配置ActiveRecord插件
ActiveRecordPlugin arp = new ActiveRecordPlugin(druidPlugin);
// 所有映射在 MappingKit 中自动化搞定
//_MappingKit.mapping(arp);
me.add(arp);
}

最新文章

123

最新摄影

闪念基因

微信扫一扫

第七城市微信公众平台