Qualifier Named injection broken
See original GitHub issue@Qualifier
annotation class Bar
class Foo
class A {
@Inject
@Bar
lateinit var foo: Foo
}
val s0 = Toothpick.openScope("S0")
s0.installModules( object : Module() {
init {
bind(Foo::class.java).withName(Bar::class.java).toInstance(Foo())
}
})
Toothpick.inject(A(), s0)
I’m getting error for the code above:
toothpick.locators.NoFactoryFoundException: No factory could be found for class com.shakuro.template.Foo. Check that the class has either a @Inject annotated constructor or contains @Inject annotated members.
There is no error when withName(Bar::class.java)
removed.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Spring @Qualifier isn't working without @Primary [duplicate]
@Qualifier is an annotation to specify the bean that you need to inject, it works together with @Autowired . ff you need to...
Read more >Contexts and Dependency Injection - Quarkus
In Quarkus, you can skip the @Inject annotation completely if the injected field declares at least one qualifier. @ConfigProperty(name = "cool") String ...
Read more >Dagger Core Semantics
Dagger is a fully static, compile-time dependency injection framework for both Java and Android. It is developed by the Java Core Libraries Team...
Read more >Spring vs. Jakarta EE: Injecting Dependencies | Enji's Blog
Comparing the Dependency Injection mechanisms of Spring and Jakarta EE (part two).
Read more >Contexts and Dependency Injection for the Java EE platform
To specify the name of a bean, the qualifier @javax.inject.Named is applied to the bean class or producer method or field. This bean...
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 FreeTop 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
Top GitHub Comments
We definitely have a bug with the qualifiers… I am gonna open a ticket. Thanks for reporting it.
With @Named though, there must be something wrong on your side, we use this feature all the time. Do you mind creating a gist or a small sample project to reproduce it?
Le lun. 15 avr. 2019 à 01:13, Ruslan Krohalev notifications@github.com a écrit :
Thanks you @stephanenicolas . Applying qualifier to field works well!