ClassCastException: com.sun.proxy.$Proxy11 cannot be cast to javax.inject.Provider
Open
- Dominant language
- Java
- Stars
- 12.7k
- Forks
- 1.7k
- Avg merge
- 11m
- Merged PRs (30d)
- 2
Description
Hello there,
We created a binding using toProvider()
bind(ProvidedClass.class).annotatedWith(Names.named("providedClass")).toProvider(ClassProvider.class).in(Singleton.class);
While creating Injector the following error happens:
java.lang.ClassCastException: com.sun.proxy.$Proxy11 cannot be cast to javax.inject.Provider
at com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:60)
What is wrong with it?
I also tried to get class instance through:
ProvidedClass providedClass = injector.getInstance(Key.get(ProvidedClass.class, Names.named("providedClass")));
but getting the same exception.
I will appreciate any suggestion.
Thanks
Krys
Contributor guide
Assessment
This issue has not been assessed yet.