作家
登录

MySQL连接配置文件密码加密及其在多种连接池上的应用

作者: 来源: 2017-12-13 16:09:29 阅读 我要评论

  •              * 解密暗码 
  •              */ 
  •             String decodePassword = new String(Base64.decodeBase64(password.getBytes())); 
  •             properties.setProperty(PASSWORD_PROPERTY, decodePassword); 
  •         } catch (Exception e) { 
  •             logger.error("CustomDatasourcePropertiesFactory#getProperties" + e.getMessage(), e); 
  •         } 
  •         return properties; 
  •     } 
  • 采取Base64来完成暗码密文解密。

    • 为ComboPooledDataSource设备名为properties的属性
    1. <property name="properties"
    2.             <bean class="com.xxx.datasource.CustomDatasourcePropertiesFactory" 
    3.                 factory-method="getProperties"
    4.                 <constructor-arg type="java.lang.String"
    5.                     <value>${jdbc.password}</value> 
    6.                 </constructor-arg> 
    7.             </bean> 
    8.         </property> 

    完全示例如下:

    1. <!-- 设备数据源-C3PO --> 
    2.     <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" 
    3.         destroy-method="close"
    4.         <property name="properties"
    5.             <bean class="com.xxx.datasource.CustomDatasourcePropertiesFactory" 
    6.                 factory-method="getProperties"
    7.                 <constructor-arg type="java.lang.String"
    8.                     <value>${jdbc.password}</value> 
    9.                 </constructor-arg> 
    10.             </bean> 

        推荐阅读

        四大巨头GAFA的收购战略——我们可不是随便买买买!

      开辟者大年夜赛路演 | 12月16日,技巧立异,北京不见不散 GAFA: What can we learn from their acquisition strategies?我们可以大年夜这些收购中发明更多的规律。显然,苹不雅想要在将来利>>>详细阅读


      本文标题:MySQL连接配置文件密码加密及其在多种连接池上的应用

      地址:http://www.17bianji.com/lsqh/39758.html

    关键词: 探索发现

    乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

    网友点评
    自媒体专栏

    评论

    热度

    精彩导读
    栏目ID=71的表不存在(操作类型=0)