Achieving IoC in the absence of a container

Now, we are well aware that DI is meant to provide the dependencies to components through either a constructor, the setter method, or properties to make them separate from dependency services. The conventional understanding is that this can only be possible by using IoC containers. However, this is not true for all cases.

Ideally, IoC containers should be used for configuring and resolving a comparatively large set of dependencies in complex applications. If you are dealing with a simple application that has just a few components and dependencies, it is sensible not to use containers. Instead, you can wire dependencies manually. 

Also, in the case of any legacy system where the integration of a ...

Get Java 9 Dependency Injection now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.