Answer the question
In order to leave comments, you need to log in
How to get generic bean without unchecked?
Hello everybody.
There is some class with parameterized type Storage<T>.
All three statements below result in a warning. unchecked cast.
Storage<User> storage = ctx.getBean("storageMemory");
Storage<User> storage = ctx.getBean(Storage.class);
Storage<User> storage = ctx.getBean("storageMemory", Storage.class);
Actually the question is:
How to get a bean of a generic type without uncecked? Annotations or xml - doesn't matter.
Is there any option other than making storage a field of some autowired container class?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question