poodinis/example/quickstart/app.d
Mike Bierlee 71ac539f2a Add canonical package module
This commit deprecates non-canonical package module "dependency.d".
2015-07-01 21:06:55 +02:00

18 lines
400 B
D

import poodinis;
interface Database{};
class RelationalDatabase : Database {}
class DataWriter {
@Autowire
public Database database; // Automatically injected when class is resolved
}
void main() {
auto dependencies = DependencyContainer.getInstance();
dependencies.register!DataWriter;
dependencies.register!(Database, RelationalDatabase);
auto writer = dependencies.resolve!DataWriter;
}