Introduction

IoC Utils aims to provide an abstraction to a chosen IoC framework. Using IoC Utils it is possible to integrate an IoC framework within a project without the worrying with the impact of code evolution of IoC technology change.

Keep in mind that there's no standard specification for IoC so this integration might not be totally seamless.
Some key features might be lost on the integration process as the chosen underlying IoC framework might not support all the operations.
Read more on this subject in the FAQ.

What is "Inversion of Control" (IoC)?

Explaining the concept behind IoC frameworks is beyond the scope of this guide. There are several good explanations available on the web. The one on Wikipedia is a pretty good one.

Another key concept behind IoC Utils and IoC frameworks is dependency injection

It follows a list of some common Java IoC frameworks:

  • Google Guice: The default implementation provided by IoC Utils (the only one at the moment).
  • Hivemind: One of the most used Java IoC frameworks.
  • Pico Container: Lightweight IoC container.
  • Spring IoC container: Spring's bundled IoC framework.
  • Tapestry 5 IoC Container: Described by some as "Hivemind rewritten and rethought". This is a new framework written from scratch. It shares the parenthood with Hivemind's and it's evolving rapidly.

There are other IoC frameworks and this list should not be seen as a classification. It merely contains frameworks analyzed by the IoC Utils team when designing the toolbox.

Main IoC features

An IoC utility like IoC Utils should have the following key features:

  • Ability to register the available services (interfaces) and it's implementations
  • Binding of services implementations to each of the declared service interfaces
  • Finding/instantiating the desired service implementation upon request

The first two can be static or dynamic features. Interfaces and implementations can be bound at coding time, during the service registry creations, or a "service finder" can be employed to search for service implementation inside JARs. This is a very handy feature commonly named "drop-in JARs". There's more information on this topic below but it is important to stress that IoC Utils features an automation to support drop-in JARs. Even if the underlying framework doesn't support this behavior (as is the case of the default IoC implementation provided, the Google Guice), IoC Utils provides means for it.

Some IoC frameworks offer many more features, but for IoC Utils the list above suffices. It's possible, though, to extend IoC Utils so it can provide more features. See the new implementations page for more on this topic.

For a more in-depth coverage on the provided IoC Utils API and it's features, please refer to the javadocs.

For a detailed user guide on the Google Guice API check the Google Guice 1.0 User's Guide.

The user guide will cover the following topics:

  • A simple example of using IoC Utils
  • Sample Application
  • Drop-in JARs