मेरे पास एक बीन है Item<T>
जिसे एक @Configuration
कक्षा में स्वत: प्राप्त करना आवश्यक है ।
@Configuration
public class AppConfig {
@Bean
public Item<String> stringItem() {
return new StringItem();
}
@Bean
public Item<Integer> integerItem() {
return new IntegerItem();
}
}
लेकिन जब मैं करने की कोशिश करता @Autowire Item<String>
हूं, तो मुझे निम्नलिखित अपवाद मिलते हैं।
"No qualifying bean of type [Item] is defined: expected single matching bean but found 2: stringItem, integerItem"
मुझे Item<T>
स्प्रिंग में जेनरिक प्रकार कैसे ऑटो करना चाहिए ?