Versions Compared

Key

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

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 Inversion of Control

...

containers and the Dependency Injection

...

pattern, please

...

see Martin Fowler's article

...

.

Spring as recommended IoC Container

Spring is, among other things, an Inversion of Control framework. As of WebWork 2.2, it is the recommended IoC container. A detailed description how Spring Integration works and how it is configured is found here.
Besides Spring, there are numerous other containers available for you to use, such as Pico or the (deprecated) integrated XWork IoC container.

WebWork/XWork integrated IoC Container

Note

As of WebWork 2.2, the WebWork/XWork IoC container has been deprecated (though not removed) and the WebWork team recommends you use Spring for all your IoC needs

In WebWork IoC, objects that are have their dependencies managed are called "components".

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

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

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

Next: Profiling

...