Java的动态代理(dynamic proxy)(三)
;
}
return property;
}
}
}
public static void main(String[] args) throws FileNotFoundException, IOException {
IConfig config = ConfigFactory.create(new FileInputStream("config/config.properties"));
String dbUrl = config.dbUrl();
boolean isLoginValidated = config.isValidated();
int dbPoolSize = config.poolSize();
}
复制代码
利用动态代理载入配置文件,并将每一个配置映射成方法,方便我们使用追踪。