Inversion of control

From Resin 3.0

Revision as of 13:20, 15 November 2005 by Ferg (Talk | contribs)
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