我只是想知道这一点。当我听说Spring并尝试了一些DI示例代码时,我发现它很酷,最终我很想知道它是如何工作并在内部实现的?即使将src与框架一起使用,我仍然不足以找出在哪里以及如何完成。
I'm just curious to know about this.When i heard about Spring and tried some sample codes of DI i found it cool and eventually i was curious to know how it works and implemented internally? Even though have the src along with the framework i'm not yet good enough to find out where and how it is done.
这与反射有关吗? (这里有Dilbert的话:-一点知识可能太危险了 :-))
Is this something to do with Reflection ? (A Dilbert quote here:- "A little knowledge can be too dangerous" :-) )
推荐答案了解基本知识注入机制起作用,请查看这个简单的15-LoC依赖项注入容器。
To understand how the basic injection mechanism works, take a look at this simple, 15-LoC dependency injection container.
当然,像Spring.Net这样的真实容器要复杂得多。 ,但这是一般想法。
Of course, real containers like Spring.Net are vastly more sophisticated, but that's the general idea.
更多推荐
如何在Spring.net内部实现依赖项注入?
发布评论