2
การเดินสายรายการโดยอัตโนมัติโดยใช้ util schema ให้ NoSuchBeanDefinitionException
ฉันมี bean ที่ฉันต้องการฉีดด้วยชื่อรายการโดยใช้ Spring util namespace <util:list id="myList">แต่ Spring กำลังมองหาชุดของ bean ประเภท String แทน การทดสอบที่เสียของฉันคือ: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration public class ListInjectionTest { @Autowired @Qualifier("myList") private List<String> stringList; @Test public void testNotNull() { TestCase.assertNotNull("stringList not null", stringList); } } บริบทของฉันคือ: <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"> <util:list …