이제 XML을 수정하여 스프링 컨테이너가 빈 스코프를 사용하는 방법을 바꿔보자. 예제 4-3의 XML 설정을 보자.
예제 4-3 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" scope="prototype">
<property name="documentDAO" ref="documentDAO" />
</bean>
<bean id="documentDAO" class="com.apress.isf.spring.data.DocumentRepository" scope="prototype">
<property name="doc1" ref="doc1" />
<property name="doc2" ref="doc2" />
<property name="doc3" ref="doc3" />
<property name="doc4" ref="doc4" />
</bean>
<!-- Document와 Type 빈 정의 생략 -->
</beans>