lishunli / nutz

Automatically exported from code.google.com/p/nutz
0 stars 0 forks source link

提前加载IOC容器中对象 #158

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
问题产生的条件:
现在IOC容器似乎是在get的时候懒加载。有些时候需要在容器��
�始化完成后自动加载配置的
bean,比如一个服务程序,一些服务对象预先加载可以在服务�
��动时发现错误,否则就要等到调
用时了。能否在ioc的接口增加是否lazy之类的标记?

Original issue reported on code.google.com by jinghu...@gmail.com on 19 Apr 2010 at 5:58

GoogleCodeExporter commented 9 years ago
你可以在你的程序启动的时候,主动调用一下 Ioc 接口

Original comment by zozoh...@gmail.com on 19 Apr 2010 at 7:25

GoogleCodeExporter commented 9 years ago
同意.
没必要.
如果的确需要,可以在启动时,调用:
for (String name: ioc.getNames)
    ioc.get(null,name);

前提的全部obj都定义了type.

Original comment by wendal1985@gmail.com on 19 Apr 2010 at 9:30

GoogleCodeExporter commented 9 years ago

Original comment by wendal1985@gmail.com on 13 May 2010 at 11:13