Sprint读取配置文件内容格式的String
来源:互联网 发布:网络推广专员薪资制度 编辑:程序博客网 时间:2024/06/06 00:07
package unit.test;import java.io.IOException;import java.util.Properties;import org.junit.Test;import org.springframework.core.io.ByteArrayResource;import org.springframework.core.io.support.PropertiesLoaderUtils;public class StringPropertyLoadTest {@Testpublic void testLoad(){String protertryStr = "spring.redis.database=0\n"+"spring.redis.host=localhost\n"+"spring.redis.port=8080\n"+"spring.redis.password=\n"+"#this is comment! \n"+"spring.redis.timeout=0\n"+"spring.redis.pool.max-active=8 #abcd \n"+"spring.redis.pool.max-wait=-1\n"+"spring.redis.pool.max-idle=8\n"+"spring.redis.pool.min-idle=0\n";ByteArrayResource resource = new ByteArrayResource(protertryStr.getBytes(), protertryStr);try {Properties properties =PropertiesLoaderUtils.loadProperties(resource);properties.entrySet().forEach(p ->{System.out.println(p.getKey()+"="+p.getValue());});} catch (IOException e) {e.printStackTrace();}}}
阅读全文
1 0
- Sprint读取配置文件内容格式的String
- 读取配置文件的节点内容
- 读取配置文件的节点内容
- 读取配置文件的内容代码
- 读取配置文件的内容 SAXReader Document
- java读取配置文件(*.propertes)的内容
- 如何读取xml配置文件的内容
- 如何读取.properties配置文件的内容
- java读取excel(xlsx格式)内容为string
- ini 配置文件的格式 及读取
- ini 配置文件的格式 及读取
- ini配置文件的格式及读取操作
- 读取Properties配置文件内容
- 读取配置文件内容
- java读取配置文件内容
- logger4j读取指定的配置文件以及配置文件的格式大全
- logger4j读取指定的配置文件以及配置文件的格式大全
- JAVA读取Excel任何格式的内容
- 打造Listview的万能适配CommonAdapter(方便以后查找)
- Android使用Intent
- chrome 调试小技巧
- Faster-rcnn voc数据集制作
- 关于 aws 免费使用12月注意事项
- Sprint读取配置文件内容格式的String
- 机器学习笔记-Logistic回归
- Spring(07)——单例注入多例之lookup-method
- 单例模式的解读以及和全局变量的区别
- zookeeper启动失败,zkServer.sh status 出错
- CString一些简单操作方法
- React/React Native 的ES5 ES6写法对照表
- 嵌入式软硬件协作简单例子分析
- 最终,还是没能成为吹牛逼的资本!(三)