这里需要注意的是这个文件路径
public class Test{
public static void main(String[] args) throws Exception {
InputStream inputStream = Test.class.getClassLoader().getResourceAsStream("config.properties");
Properties properties = new Properties();
properties.load(inputStream);
System.out.println(properties.getProperty("key"));
}
}