Child pages
  • Dependency Injection

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Dependency injection removes the responsibility for object creation and object linking from the objects themselves to a factory. The factory is often provided by an Inversion of Control (IoC) container. For an overview of of Inversion of Control containers and the Dependency Injection pattern, please see Martin Fowler's article.

Internally, the framework uses its own dependency injection container , based on that is very similar to Google Guice. Both were originally developed by Bob Lee. Plugins are available to integrate applications with other containers, including the IoC containers (e.g. Spring Plugin and the , Plexus Plugin). An application can even use a local copy of Google Guice for dependency injection needs.

(info) Actions can still be instantiated via the Spring configuration by way of the Spring Plugin, but Spring is entirely optional now.

(warning) The WebWork/XWork IoC container utilized by WebWork 2.1 is not supported by Struts 2.