더북(TheBook)

따라서 documentDAO 빈에 <set />을 적용하려면, 먼저 DocumentRepository 클래스를 수정해서 java.util.Set을 포함하도록 해야 한다. 예제 5-5의 XML 설정을 살펴보자.

 예제 5-5 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.ServiceSearchEngine">

<property name="documentDAO" ref="documentDAO" />

</bean>

 

<bean id="documentDAO" class="com.apress.isf.spring.data.DocumentRepository">

<property name="documents">

<set>

<ref bean="doc1" />

<ref bean="doc2" />

<ref bean="doc3" />

<ref bean="doc4" />

</set>

</property>

</bean>

 

<!-- Document와 Type 빈 정의 생략 -->

 

</beans>


신간 소식 구독하기
뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.