【发布时间】:2012-05-05 16:32:39
【问题描述】:
让我们考虑一个这样的对象链:
Earth->Continent->Country->City->name
我们还要考虑Earth.class 有public static void main(String[] args)
当应用程序使用命令行选项执行时,例如Barcelona,在不引入中间参数的情况下将其传递给 City 对象的最佳方法是什么?
对象是在程序执行期间的不同阶段创建的。
我们应该将name 变量设为静态还是使用 IoC,例如 Spring 或 Google Guice?
还有其他选择吗?
欢迎提出任何想法。
【问题讨论】: