public static Properties load(String path) throws IOException { Properties properties = new Properties(); FileInputStream fis = null; try { fis = new FileInputStream(ResourceUtils.getClassPath() + "/" + path); properties.load(fis); } catch (FileNotFoundException e) { e.printStackTrace(); } finally { if (fis != null) { try { fis.close(); } catch (IOException e) { e.printStackTrace(); } } } return properties; }
public static void main(String[] args) { System.out.println(ResourceUtils.getClassPath()); System.out.println(ResourceUtils.packageToPath("cn.test.module")); System.out.println(ResourceUtils.pathToPackage("cn/test/module")); }