더북(TheBook)

테스트를 변경하고 프로파일 기능이 어떻게 동작하는지 살펴보자. 예제 7-2의 프로파일을 사용하는 XML 설정을 보자.

 예제 7-2 mydocuments-profiles-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"

xmlns:context="http://www.springframework.org/schema/context"

xsi:schemaLocation="http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans.xsd

http://www.springframework.org/schema/context

http://www.springframework.org/schema/context/spring-context-4.0.xsd">

 

<context:component-scan base-package="com.apress.isf.spring.service" />

 

<beans profile="dev">

<bean id="engine"

class="com.apress.isf.spring.service.SearchEngineService">

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

</bean>

</beans>

 

<beans profile="dev,qa">

<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>

 

<!—- 나머지 빈 정의 생략 -->

 

</beans>

 

</beans>


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