Named BeanDefinition not using 'primary_type'
See original GitHub issueDescribe the bug
When defining two objects with same named
string, it fails with DefinitionOverrideException
To Reproduce Steps to reproduce the behavior:
- Create definitions like:
factory(named("statusOne")){ StatusObject(get(named("statusOne"))) }
single(named("statusOne")){ StatusObjectConstructorParam() }
- start app…
startKoin{...}
Expected behavior
named
definitions also check primary_type
to determine object definition
Koin project used and used version (please complete the following information):
implementation "org.koin:koin-androidx-scope:2.0.1"
implementation "org.koin:koin-androidx-viewmodel:2.0.1"
implementation "org.koin:koin-androidx-ext:2.0.1"
this appeard after migrating from 1.0.2
to 2.0.1
- on 1.x it such definitions were working fine, on 2.x every named (eg. based on enums) definitions should be changed, which is painful job 😉
or there is some other way I didn’t in docs?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Mocked named beans in Spring configuration without using ...
Mocked named beans in Spring configuration without using allow-bean-definition-overriding? ... I have two beans with the same signature. They are ...
Read more >Core Technologies - Spring
Motivations for not supplying a name are related to using inner beans and autowiring collaborators. Bean Naming Conventions. The convention is to use...
Read more >Choosing from multiple beans in the context - Manning
Using the @Qualifier annotation, I specify the name of the bean I want Spring to inject from the context, and I don't rely...
Read more >Installing Hippo Channel Manager Page Management Support
... your SITE application to shadow the file with a custom bean definition. ... < sv:property sv:name = "jcr:primaryType" sv:type = "Name" >....
Read more >Spring NoSuchBeanDefinitionException - Baeldung
Now if the dependency BeanB is not defined in the Spring Context, the bootstrap process will fail with the no such bean definition...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hello @bovquier,
this behavior is intended: a qualifier is unique for all definitions. What is your use case behind reusing the same qualifier?
@arnaudgiuliani the reason is eg. I’m using
ItemKeyedDataSource
andDataSource.Factory
from jetpack paging, and same implementations for few source types (eg. based on item status), this doesn’t allow me to make them defined in simple way like in Kotlin1 (have such setup for that). In Koin2, this will need to createActiveDataSource
/PendingDataSource
/LockedDataSource
, to match the requirements. In Koin1 I have something like:and I have 2 lines, and do not think about how many PagesTypes there will be, all adapter pages will have its sources injected. But couldn’t achive that in K2, but I may be missing something in docs, and you, guys, can give some hint, if there is such simple approach for that.