mirror of
https://github.com/mbierlee/poodinis.git
synced 2024-11-15 12:14:01 +01:00
18 lines
416 B
D
18 lines
416 B
D
|
import poodinis.dependency;
|
||
|
|
||
|
interface Database{};
|
||
|
class RelationalDatabase : Database {}
|
||
|
|
||
|
class DataWriter {
|
||
|
@Autowire
|
||
|
public Database database; // Automatically injected when class is resolved
|
||
|
}
|
||
|
|
||
|
void main() {
|
||
|
auto container = DependencyContainer.getInstance();
|
||
|
container.register!DataWriter;
|
||
|
container.register!(Database, RelationalDatabase);
|
||
|
|
||
|
auto writer = container.resolve!DataWriter;
|
||
|
}
|