Inversion of control
From Resin 3.0
(Difference between revisions)
m (Inversion of Control moved to Inversion of control) |
|||
(One intermediate revision by one user not shown) | |||
Line 1: | Line 1: | ||
+ | [[Category:Concepts]] | ||
+ | |||
Corresponding Resin documentation is http://www.caucho.com/resin-3.0/ioc | Corresponding Resin documentation is http://www.caucho.com/resin-3.0/ioc | ||
Latest revision as of 04:14, 14 February 2006
Corresponding Resin documentation is http://www.caucho.com/resin-3.0/ioc
[edit] See Also
[edit] 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.