0

I know that we can autowire all implementations of an interface using this sort of configuration.

@Configurable
public class Target {

    @Autowired
    private List<IType> itypes;

}

Or by using byType feature in XML.

In my code base, class is not annotated with @Configuration all beans are injected from XML and I cannot use byType as there are two beans of the same type (already existing) in the target class.

What is the way to use the same feature from XML (apart from putting all interface implementations one-by-one) to get all th ebeans by interface type?

instanceOfObject
  • 2,936
  • 5
  • 49
  • 85
  • @BobTheBuilder..I want to get all the beans of type IType. – instanceOfObject Sep 04 '14 at 05:06
  • 1
    possible duplicate of [How to collect and inject all beans of a given type in Spring XML configuration](http://stackoverflow.com/questions/2799316/how-to-collect-and-inject-all-beans-of-a-given-type-in-spring-xml-configuration) – Andrei Stefan Sep 04 '14 at 05:06

1 Answers1

0

Set autowire="byType" on the target bean and specify the properties that can not by autowired by type specifically.

Maarten Winkels
  • 2,407
  • 16
  • 15