'context:property-placeholder'에 해당되는 글 1건

  1. 2011.08.03 <context:property-placeholder/> 를 사용할때 property file의 encoding 지정하기

<context:property-placeholder/> 를 사용할때 property file의 encoding 지정하기


config.property
#한글로 된 프로퍼티값
attach.path=c:\첨부파일\ 
 위처럼 property 파일에 있는 값들중 한글값은 제대로 받아지지 않는다.



 뭐 이것저것 받을 수 있는 방법이야 많겠지만 많은 방법들 중 한가지로 요렇게도 할 수 있다.
<bean id="fileEncoding" class="java.lang.String">
	<constructor-arg value="UTF-8"/>
</bean>
 
<context:property-placeholder location="classpath:config.properties" file-encoding="fileEncoding"/>


file-encoding="UTF-8" 요렇게만 하면 될줄 알았는데 그렇게 설정하니 No bean named 'UTF-8' is defined 라나 뭐라나~

어렴풋이 대략 찾아보니 버그라고 쫑알쫑알 거리는 사람들이 있던데 버근지 원래 저래 하면 안되는건지 나는 잘 모르겠다.

더 찾아 보기도 귀찮고~~~



원래는
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
	<property name="locations" value="classpath:config.properties"/>
	<property name="fileEncoding" value="UTF-8"/>
</bean>
요렇게 썼었는데 <context:property-placeholder/> 이게 왠지 더 있어 보이고 한 라인으로 끝낼 수 있을것 같아서 바꿨는데

file-encoding="UTF-8" 이게 안되서 설정을 위한 라인수가 더 길어져 버렸다~
 
prev 1 next