02 | XML 설정 내의 컬렉션
다음으로, 예제 5-4에 나타낸 XML 설정 파일을 살펴보자.
예제 5-4 mydocuments-context.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="engine" class="com.apress.isf.spring.service.SearchEngineService">
<property name="documentDAO" ref="documentDAO" />
</bean>
<bean id="documentDAO" class="com.apress.isf.spring.data.DocumentRepository">
<property name="documents">
<list>
<ref bean="doc1" />
<ref bean="doc2" />
<ref bean="doc3" />
<ref bean="doc4" />
</list>
</property>
</bean>
<bean id="typeDAO" class="com.apress.isf.spring.data.TypeDataRepository">
<property name="types">
<map>
<entry key="webType" value-ref="webType" />
<entry key="pdfType" value-ref="pdfType" />
<entry key="noteType" value-ref="noteType" />
</map>
</property>
</bean>
<!-- Document와 Type 빈 정의 생략 -->
</beans>
mydocuments-context.xml 파일(예제 5-4 참고)에서는 새로운 리스트를 반영하기 위해 documentDAO 빈을 수정하고, 엔트리 몇 개를 포함하는 Map을 받을 수 있도록 typeDAO 빈도 수정했다. 하지만 잠깐! 스프링 프레임워크가 컬렉션을 어떻게 다루는지 설명이 필요할 것 같다.