try (InputStream is = getClass().getResourceAsStream("/test.properties")) {
Properties properties = new Properties();
properties.load(is);
ps=new PropertiesPropertySource("main", properties);
} catch (IOException e) {
log.error("Something went wrong", e);
}
 private String getPomPerpertiesPath() {
String classPath = getClass().getClassLoader().getResource("").getPath();
String aString = "classes/";
String targetPath = classPath.substring(0, classPath.lastIndexOf(aString));
StringBuilder sb = new StringBuilder();
sb.append(targetPath).append("maven-archiver/pom.properties");
return sb.toString();
}*/
  private Properties getProperties(InputStream is) throws IOException {
Properties properties = new Properties();
properties.load(is);
log.info("All defined properties: {}", properties);
return properties;
}
  private Properties getProperties(String fileName) throws IOException {
try (InputStream is = new FileInputStream(new File(fileName))) {
Properties properties = new Properties();
properties.load(is);
log.info("All defined properties: {}", properties);
return properties;
}
 System.out.println(getClass().getClassLoader().getResource(""));
System.out.println(getClass().getClassLoader().getResource("").getPath());
System.out.println(getClass().getResource(""));
System.out.println(getClass().getResource("").getPath()); file:/C:/Users/lt32806/git/tempest/tempest-app/tempest-app-report/target/classes/
/C:/Users/lt32806/git/tempest/tempest-app/tempest-app-report/target/classes/
file:/C:/Users/lt32806/git/tempest/tempest-app/tempest-app-report/target/classes/com/citi/simpliciti/tempest/report/
/C:/Users/lt32806/git/tempest/tempest-app/tempest-app-report/target/classes/com/citi/simpliciti/tempest/report/ https://blog.csdn.net/wws921104/article/details/72637050/
http://riddickbryant.iteye.com/blog/436693

最新文章

  1. datatable-提示
  2. 转:Web应用程序项目XX已配置为使用IIS
  3. iOS 清理缓存功能的实现第二种方法
  4. Android 中获得notification的发出时间
  5. oracle11g导入到10g
  6. MVC 中使用扩展方法
  7. NaN属性,isNaN函数
  8. UVALIVE 3026 Period
  9. 范围for语句 && 列表初始值&& 标准库函数begin和end
  10. hdu 2565 放大的X
  11. 获取控件id
  12. android: activity之间切换的抽屉效果
  13. iOS开发之应用程序启动图片规格
  14. jquery插件封装
  15. Spring Boot框架的自动配置
  16. Swift学习笔记6
  17. golang中的接口实现(二)
  18. bat批处理设置静态、动态、ping、查看网络配置
  19. Hibernate入门第二课 Hibernate Tools for Eclipse Plugins安装
  20. Spring Cloud(二):服务注册与发现 Eureka【Finchley 版】

热门文章

  1. 动态参数 名称空间 作用域 作用域链 加载顺序 函数的嵌套 global nonlocal 等的用法总结
  2. [patl2-001]紧急救援
  3. v8垃圾回收和js垃圾回收机制
  4. ARC100C Linear Approximation
  5. cakephp增删改查
  6. Entity Framework Tutorial Basics(20):Persistence in Entity Framework
  7. Windows系统编程之进程同步试验
  8. dojo1.7 加载器
  9. MySQL的ODBC安装错误问题!
  10. 2019-RHCSA-红帽题库(稳定)