框架的概念及反射技术开发框架的原理

  className java.lang.ArrayList
    加载配置文件
    //getRealPath();//金山词霸/内部
    // 一定要记住用完整的路径,但完成的路径不是硬编码,而是运算出来的。
    InputStream ips = new FileInputStream("config.properties");
    Properties props =     new Properties();
    props.load(ips);
    ips.close();
    String className= props.getProperty("className");
    Collection collections = (Collection)Class.forName(className);

通过配置文件来生成类

用类加载器的方式管理资源和配置文件

   配置文件放在ClassPath下
    InputStream ips = ReflectTest2.class.getClassLoader().getResourceAsStream("cn/itcast/day1/confg.properties");
    InputStream ips =ReflectTest2.class.getResourceAsStream("rousource/config.properties");
    ...
    明白相对路径和绝对路径
原文地址:https://www.cnblogs.com/atomicbomb/p/6624139.html