问题
I'm just curious to know about this.When i heard about Spring.net 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.
Is this something to do with Reflection ? (A Dilbert quote here:- "A little knowledge can be too dangerous" :-) )
回答1:
To understand how the basic injection mechanism works, take a look at this simple, 15-LoC dependency injection container.
Of course, real containers like Spring.Net are vastly more sophisticated, but that's the general idea.
来源:https://stackoverflow.com/questions/1082898/how-exactly-dependency-injection-is-implemented-internally-in-spring-net