Aus Java Student User Group Austria - Java + JVM in Wien Österreich / Vienna Austria
|
|
(28 dazwischenliegende Versionen von 19 Benutzern werden nicht angezeigt) |
Zeile 1: |
Zeile 1: |
− | Here is a reiteration of what rlaely makes Dependency Injection (DI) worthwhile. First of all IoC and DI is not the same thing. DI is one type of IoC (read ch. 4 of Pro Spring ).Example:You have component CC, which needs to use a service of type SS. Of course, CC should ideally not need knowledge about any implementations of SS. One implementation of SS is called SImp. SImp can of course not have knowledge about where it should be used, so no references to CC within SImp.Now: How can we make CC use SImp? Well, in my opinion DI handles this very elegantly:It stands outside of both CC and SImp and creates (injects) the link (dependency) between the two.
| + | #REDIRECT [[:Category:Voting]] |
Aktuelle Version vom 21. Februar 2013, 23:12 Uhr