diff --git a/README.md b/README.md index debe74b6..47d754e5 100644 --- a/README.md +++ b/README.md @@ -164,12 +164,15 @@ interface MainScope { @motif.Objects class Objects { + DatabaseImpl databaseImpl() { + return new DatabaseImpl(); + } + // Motif requires explicit dependency declarations to properly resolve and inject dependencies across scopes @Expose - Database database() { - return new Database(); + Database database(DatabaseImpl impl) { + return impl; } - // ... } } @@ -202,37 +205,6 @@ MainScope mainScope = new MainScopeImpl(); ChildScope childScope = mainScope.child(); ``` -## Dependency Resolution and Exposure - -Motif requires explicit dependency declarations to properly resolve and inject dependencies across scopes. When a parent scope needs to provide a dependency to a child scope, the dependency must be explicitly exposed using the `@Expose` annotation. - -For example: - -```kotlin -@motif.Scope -interface ParentScope { - @motif.Objects - class Objects { - fun provideImpl(): Impl { - return Impl() - } - - @Expose - fun provideApi(impl: Impl): Api { - return impl - } - } -} - -@motif.Scope -interface ChildScope { - @motif.Objects - abstract class Objects { - abstract fun api(): Api - } -} -``` - ## Root Scopes By extending `Creatable` you can specify exactly the dependencies you expect from the parent `Scope`. This allows