Inversion of control

From Resin 3.0

(Difference between revisions)
Jump to: navigation, search
m (Inversion of Control moved to Inversion of control)
 

Latest revision as of 04:14, 14 February 2006


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