예제 7-5에서는 특수 애너테이션에 전달한 값에 따라 모든 메서드에 이르게 해주는 CustomProfile 클래스를 생성했다. 또한, 예제에서 볼 수 있듯이 ProfileValueSource 인터페이스의 get 메서드를 구현했다. 이제 예제 7-6과 예제 7-7에 나타낸 것처럼 XML과 테스트 클래스를 수정하자.
예제 7-6 mydocuments-custom-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">
<bean id="engine" class="com.apress.isf.spring.service.SearchEngineService">
<property name="documentDAO" ref="documentDAO" />
</bean>
<!-- 빈 정의 생략 -->
</beans>