Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Dependency Injection Framework

Problem Statement

Fedora's original Server and Module classes were designed in 2002, and provided a common way for major functional components ("modules") of the repository to be plugged in, configured, initialized, and stopped. Problems with the existing framework include:

  • It's homegrown. Better, more widely-understood frameworks have come along.
  • Unit testing is unnecessarily complicated. The base Module class depends on a Server instance being available in order to function, and the Server base class is not easily mocked.

Requirements

  • Use standard, well-known frameworks/libraries to:
    • Resolve inter-module dependencies via dependency injection
    • Provide a way to de-initialize (cleanup) modules when the server shuts down
    • Allow re-configuration and plugging in of alternative modules without re-compiling

Non-requirements

This work will NOT attempt to:

  • Provide a way to dynamically re-configure modules without restarting
  • Provide the ability to run modules in their own classloader space

These capabilities may be added in the future, possibly with the help of OSGi.

Framework Choice

Popular frameworks that support the dependency injection pattern include Spring, PicoContainer, and Guice.

How do they compareSpring and Guice have both been mentioned as candidates here.  What are the tradeoffs?  Why one over the other?