Mybatis学习之读取配置文件(三)
来源:互联网 发布:oracle数据库课程设计 编辑:程序博客网 时间:2024/06/01 19:12
package com.learn.chapter2.test;import java.io.InputStream;import java.io.InputStreamReader;import java.io.Reader;import java.util.Properties;import org.apache.ibatis.io.Resources;public class ReadXMLandProperties {@SuppressWarnings("unused")public static void main(String[] args) {InputStream cfgStream = null;Reader cfgReader = null;InputStream proStream = null;Reader proReader = null;Properties properties = null;try{//读取配置文件cfgStream = Resources.getResourceAsStream("mybatis-config.xml");cfgReader = new InputStreamReader(cfgStream);//读取属性文件proStream = Resources.getResourceAsStream("jdbc.properties");proReader = new InputStreamReader(proStream);properties.load(cfgStream);//解密为明文properties.setProperty("username", decode(properties.getProperty("username")));properties.setProperty("password", decode(properties.getProperty("password")));}catch (Exception e) {// TODO: handle exception}}private static String decode(String str){//解密return str;}}
0 0
- Mybatis学习之读取配置文件(三)
- (三)mybatis学习之全局配置文件(sqlMapConfig.xml)
- 一起来学习Mybatis(三)-配置文件之properties 属性
- Mybatis学习记录(三)--Mybatis配置文件详解
- Mybatis学习记录(三)--Mybatis配置文件详解
- Mybatis学习总结(三).Mybatis全局配置文件
- 【mybatis源码分析】原理分析之三:初始化(配置文件读取和解析)
- MyBatis学习 之 四、MyBatis配置文件
- MyBatis学习 之 四、MyBatis配置文件
- MyBatis学习 之 四、MyBatis配置文件
- MyBatis学习 之 五、MyBatis配置文件
- MyBatis学习 之 四、MyBatis配置文件
- MyBatis学习 之 四、MyBatis配置文件
- MyBatis学习 之 五、MyBatis配置文件
- MyBatis学习 之 四、MyBatis配置文件
- MyBatis学习 之 四、MyBatis主配置文件
- MyBatis学习 之 四、MyBatis配置文件
- MyBatis学习 之 四、MyBatis配置文件
- 博客开通第一天
- 移动端rem布局
- 【c++】(初识)继承
- Buffered增强添加IO流功能
- Linux的五个查找命令
- Mybatis学习之读取配置文件(三)
- 冒泡排序
- 当文件中存在NULL时,如何读取文件,使其转为NA?
- matcaffe 使用中,matlab直接错误退出问题
- Linux运维笔记-文档总结-Linux中系统服务管理
- 两分钟彻底让你明白Android中onInterceptTouchEvent与onTouchEvent(图文)!
- 由于下列原因,安装程序无法继续microsoft office 2016 需要通用CRT(KB2999226)
- 【编程题】好多鱼!--大鱼吃小鱼问题
- 2014 蓝桥杯JavaB组省赛 李白打酒