Inversion of control

From Resin 3.0

Revision as of 20:14, 13 February 2006 by Sam (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Corresponding Resin documentation is http://www.caucho.com/resin-3.0/ioc

See Also

Overview

Inversion of Control is a fancy name for a simple concept: moving configuration code out of application code and into the container's configuration.

For example, an Inversion of Control database servlet would let the configuration file lookup a javax.sql.DataSource from JNDI and configure the servlet directly.

A non-IoC database servlet would extract the initialization parameters using getInitParameter and lookup the name in JNDI itself.

Using the Inversion of Control style offers several benefits:

  • It decouples the application code from its configuration, e.g. removing all JNDI dependencies
  • It allows more flexible configuration in the configuration file.
  • It makes the application more easily testable, since calling setters is easier than configuring a JNDI environment.

Inversion of Control Tutorials

Personal tools