maven项目中读取.properties文件

maven项目中源代码的位置:


maven项目中编译后代码的位置:


相应的java类的方法:


try {
		prop.load(AnyShare.class.getResourceAsStream("/config/anyshare/openapi.properties"));
		} catch (IOException e) {
			e.printStackTrace();
		}
		String re = prop.getProperty(key);


猜你喜欢

转载自blog.csdn.net/ml863606/article/details/78086696