spring - Sample IoC, that is not DI -
dependency injection form of inversion of control.
could please specify other form of inversion of control, not dependency injection ? is there java framework ioc container, not di container ? which part of spring ioc, not di ?
inversion of command ability allow framework run custom code. martin fowler says here:
inversion of command mutual phenomenon come across when extending frameworks. indeed it's seen defining characteristic of framework.
so illustration of inversion of control:
public class homepage : page { protected override void onpageload(object sender, eventargs e) { // here custom code } }
here have custom class 'by convention' framework (asp.net web forms in case) picks , runs our custom code. way done here inheritance , overriding virtual methods of base of operations class framework provides.
so other illustration of inversion of control:
public class homecontroller : controller { public actionresult save(homesavemodel model) { // here custom code } }
here have our own custom controller 1 time again framework phone call our code convention. here still utilize base of operations class given framework, framework phone call our save
action using reflection.
inversion of command hooking framework code. note in examples above there no dependency injection ever (nor there service location).
is there java framework ioc container, not di container ?
the name "ioc container" misleading, because tools meant help wire dependency graphs in application , not help wiring code framework. ioc property of framework; if doesn't ioc, it's not framework: it's library. hence "ioc containers" libraries, not frameworks , have no relationship frameworks utilize (such web frameworks such asp.net).
so in sense, there no such thing "ioc container", since can't do; definition. in context, question stopped making sense :-), still reply it: no, "ioc containers" "di containers" never "ioc containers".
spring dependency-injection inversion-of-control
No comments:
Post a Comment