Extended Autowiring

Description

Allow autowiring to be extended and don't limit it to BuilderFactory.

Currently, all the autowiring functionality is implemented in BuilderFactory. It would be nice if there was a public service which is able to autowire any object (including constructor-injection) manually and make BuilderFactory actually just a user of that service. There are many places where we could use that functionallity.

Also, autowiring should be configurable and allow custom injectors to be contributed (e.g. to gaderian.InjectionProviders).

The full functionality should also be available without any configurations to allow to completely customise any injections. An example of this would be a extension mechanism for Gaderian, where injections would be done outside the registry.

Outline:

  • interface InjectionProvider: Provides injectable objects.

  • interface Injector: A configurable injector. Provides injection in two separate steps: construct() and setProperties. Possible injections can be configured using addInjectionProvider and removeInjectionProvider.

  • class DefaultInjector: A default implementation of the above interface. Instances are 'empty', i.e. they can't inject anything.

  • interface InjectorFactory: The service providing instances of Injector which are fully configured from the registry. Used by BuilderFactory and possibly other services.

Environment

None

Status

Assignee

Raffael Herzog

Reporter

Raffael Herzog

Labels

None

Components

Priority

Major
Configure