• Post Reply Bookmark Topic Watch Topic
  • New Topic

Spring autowire many implementation of Interface  RSS feed

 
Dumidu Udayanga
Greenhorn
Posts: 11
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

There are multiple classes are implementing interfaces, and then in a third class where we have autowired list, now I have made another class and extend it from the interface but its beans don't get registered
 
Junilu Lacar
Sheriff
Posts: 11435
176
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's not how the Spring autowiring mechanism works. You marked a field that is of type List<A> to be autowired. I doubt that's even possible because of generics type erasure. Search for more info about how autowiring in Spring works. This article looks ok: https://howtodoinjava.com/spring/spring-core/spring-beans-autowiring-concepts/
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!