KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
So I have a number of generics in Spring 3.2 and ideally my architecture would look something like this. class GenericDao<T>{} class GenericService<T, T_DAO extends GenericDao<T>> { // FAILS @Autowired T_DAO; } @Component class Foo{} @Repository class FooDao extends GenericDao<Foo>{} @Service FooService extends GenericService<Foo, FooDao>{} Unfortunately with multiple implementations of the generics the autowiring throws an error about multiple matching bean definitions. I assume this is because @Autowired processes before type erasure. Every solution I've found or come up with looks ugly to me or just inexplicably refuses to work. What is the best way around this problem?
Tags (comma-separated)
Save Edits
Cancel