Go to file
2016-09-03 17:02:19 +02:00
example Add example on constructor injection 2016-08-25 21:17:47 +02:00
source/poodinis Prevent creation of circular dependencies in constructors 2016-09-03 16:57:38 +02:00
test/poodinis Prevent creation of circular dependencies in constructors 2016-09-03 16:57:38 +02:00
.gitignore Add registerOnResolveExample to .gitignore 2016-06-26 21:45:48 -06:00
.travis.yml Build with latest beta 2016-08-31 14:08:54 +02:00
CHANGES.md Add constructor injection to documentation 2016-08-23 21:10:31 +02:00
dub.json Add example on constructor injection 2016-08-25 21:17:47 +02:00
LICENSE.txt Update copyrights 2016-01-06 20:18:35 +01:00
README.md Add constructor injection to documentation 2016-08-23 21:10:31 +02:00
TUTORIAL.md Add persistent resolve options to tutorial 2016-09-03 17:02:19 +02:00

Poodinis Dependency Injection Framework

Version 7.0.0
Copyright 2014-2016 Mike Bierlee
Licensed under the terms of the MIT license - See LICENSE.txt

Master: Build Status - Dev: Build Status

Poodinis is a dependency injection framework for the D programming language. It is inspired by the Spring Framework and Hypodermic IoC container for C++. Poodinis supports registering and resolving classes either by concrete type or interface. Automatic injection of dependencies is supported through the use of UDAs or constructors.

Requires at least a D 2.068.0 compatible compiler
Uses the Phobos standard library
Can be built with DUB 0.9.24 or higher

History

For a full overview of changes, see CHANGES.md

Getting started

###DUB Dependency See the Poodinis DUB project page for instructions on how to include Poodinis into your project.

###Quickstart The following example shows the typical usage of Poodinis:

import poodinis;

interface Database{};
class RelationalDatabase : Database {}

class DataWriter {
	@Autowire
	private Database database; // Automatically injected when class is resolved
}

void main() {
	auto dependencies = new shared DependencyContainer();
	dependencies.register!DataWriter;
	dependencies.register!(Database, RelationalDatabase);

	auto writer = dependencies.resolve!DataWriter;
}

For more examples, see the examples directory.

###Tutorial For an extended tutorial walking you through all functionality offered by Poodinis, see TUTORIAL.md

Documentation

You can generate Public API documentation from the source code using DUB:

dub build --build=ddox

The documentation can then be found in docs/

Future Work

  • Component scan (auto-registration)
  • Phobos collections autowiring
  • Named qualifiers
  • Value type injection

Contributing

Any and all pull requests are welcome! If you (only) want discuss changes before making them, feel free to open an Issue on github. Please develop your changes on (a branch based on) the develop branch. Continuous integration is preferred so feature branches are not neccessary.