Jsp-Servlet/Spring
properties 리소스 번들 사용하기
seongsland
2011. 3. 21. 17:41
스프링 프레임웍에 통합된 여러 설정파일에 중복되는 정보를 properties 파일에 저장하여, 한번에 관리할 수 있다.
아래와 같은 빈을 추가하고, properties 파일에 키와 값을 정의하고, 설정파일에 ${키} 와 같이 사용하면,
스프링 구동시 properties 파일에 설정한 키에 해당한 값으로 대체된다. 스프링 프레임웍에서는 여러 프레임웍이
통합되어 사용되기 때문에, 규모가 끝 프로젝트의 경우에는 위와 같이 사용하는 것이 필요할 때가 있다.
- <bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>/WEB-INF/config/properties/jdbc.properties</value>
</property>
</bean>