Comments (1)
Hello,
if you try to resolve Animal
type you will have a conflict: Koin doesn't know on which instance definition to go.
Context is there to help against visibility (parent/child) and to be dropped later if needed.
I think you have to think about 2 possible ways :
- provide definition with a name :
provide("wombat") { wombat() } bind Animal::class
- use a factory and pass argument to it
If you provide a definition with a name, use it when you inject: val animal: Animal by inject("wombat")
Last point, your class Pojo can't be injected like that. You should write it:
class Pojo : KoinComponent {
val animal: Animal by inject()
}
from koin.
Related Issues (20)
- Koin+Ktor: first server reload breaks consequent server responses
- How to share singletons between isolated Koin contexts in Ktor? HOT 1
- Repeated module includes override overriden beans: Diamond problem
- `stately-common` transitive dependency causing issues with other dependencies HOT 1
- ViewModels scoping in composables is confusing (or broken?) HOT 1
- Consider supporting nullable inject on compose
- Automatically destroy Closeable beans on shutdown HOT 2
- Update iOS view with mutable state
- Use ktor-koin3.5.2-RC1, with ktor auto-reload, not working ktor-server. HOT 1
- Typo in the documentation HOT 2
- [koin-core] flatten function HOT 5
- Proofreading documentations
- Update koin-compose to use Compose 1.6.0 HOT 3
- style: ktlint and spotless plugin
- Stackoverflow when binding class to interface with declaration of class in seperate single block
- The Constructor DSL could inject parameters via getOrNull() HOT 1
- SavedStateHandle instance not the same as in NavBackStackEntry HOT 1
- Add route support to koinNavGraphViewModel() extension HOT 1
- ViewModel scope handling in 3.5.4-RC1 HOT 7
- [Enhancement] Auto Replace for Deprecation not working correctly HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from koin.